@atlaskit/editor-core 185.12.0 → 185.12.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 +6 -0
- package/dist/cjs/plugins/card/ui/EditLinkToolbar.js +4 -3
- package/dist/cjs/plugins/card/ui/EditorSmartCardEventsNext.js +15 -36
- package/dist/cjs/plugins/hyperlink/Toolbar.js +1 -0
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/plugins/card/ui/EditLinkToolbar.js +4 -3
- package/dist/es2019/plugins/card/ui/EditorSmartCardEventsNext.js +21 -35
- package/dist/es2019/plugins/hyperlink/Toolbar.js +1 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/plugins/card/ui/EditLinkToolbar.js +4 -3
- package/dist/esm/plugins/card/ui/EditorSmartCardEventsNext.js +15 -36
- package/dist/esm/plugins/hyperlink/Toolbar.js +1 -0
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/plugins/card/types.d.ts +2 -3
- package/dist/types/plugins/card/ui/EditLinkToolbar.d.ts +2 -2
- package/dist/types-ts4.5/plugins/card/types.d.ts +2 -3
- package/dist/types-ts4.5/plugins/card/ui/EditLinkToolbar.d.ts +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 185.12.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`a9bd271beba`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a9bd271beba) - Fixes link updated linking platform events being dispatched without an updateType
|
|
8
|
+
|
|
3
9
|
## 185.12.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -87,10 +87,10 @@ var EditLinkToolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
87
87
|
,
|
|
88
88
|
invokeMethod: _analytics.INPUT_METHOD.FLOATING_TB,
|
|
89
89
|
featureFlags: featureFlags,
|
|
90
|
-
onSubmit: function onSubmit(href, title, displayText,
|
|
90
|
+
onSubmit: function onSubmit(href, title, displayText, inputMethod, analytic) {
|
|
91
91
|
_this2.hideLinkToolbar();
|
|
92
92
|
if (_onSubmit) {
|
|
93
|
-
_onSubmit(href, displayText || title, analytic);
|
|
93
|
+
_onSubmit(href, displayText || title, inputMethod, analytic);
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
});
|
|
@@ -142,7 +142,7 @@ var buildEditLinkToolbar = function buildEditLinkToolbar(_ref) {
|
|
|
142
142
|
node: node,
|
|
143
143
|
featureFlags: featureFlags,
|
|
144
144
|
forceFocusSelector: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.floatingToolbar.actions) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.forceFocusSelector,
|
|
145
|
-
onSubmit: function onSubmit(newHref, newText, analytic) {
|
|
145
|
+
onSubmit: function onSubmit(newHref, newText, inputMethod, analytic) {
|
|
146
146
|
var urlChanged = newHref !== displayInfo.url;
|
|
147
147
|
var titleChanged = newText !== displayInfo.title;
|
|
148
148
|
|
|
@@ -152,6 +152,7 @@ var buildEditLinkToolbar = function buildEditLinkToolbar(_ref) {
|
|
|
152
152
|
var _pluginInjectionApi$d2;
|
|
153
153
|
return (0, _card.commandWithMetadata)((0, _doc.changeSelectedCardToLink)(newText, newHref, undefined, undefined, undefined, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d2 = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.actions), {
|
|
154
154
|
action: _analytics.ACTION.UPDATED,
|
|
155
|
+
inputMethod: inputMethod,
|
|
155
156
|
sourceEvent: analytic
|
|
156
157
|
})(view.state, view.dispatch);
|
|
157
158
|
}
|
|
@@ -12,7 +12,6 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
|
|
|
12
12
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
13
13
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
14
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
16
15
|
var _react = _interopRequireWildcard(require("react"));
|
|
17
16
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
18
17
|
var _linkAnalytics = require("@atlaskit/link-analytics");
|
|
@@ -21,9 +20,6 @@ var _analyticsNext = require("@atlaskit/analytics-next");
|
|
|
21
20
|
var _actions = require("../pm-plugins/actions");
|
|
22
21
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
23
22
|
var _state = require("../pm-plugins/util/state");
|
|
24
|
-
var _excluded = ["url", "display", "nodeContext"],
|
|
25
|
-
_excluded2 = ["url", "display", "previousDisplay", "nodeContext"],
|
|
26
|
-
_excluded3 = ["url", "display", "nodeContext"];
|
|
27
23
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
28
24
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
29
25
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
@@ -47,14 +43,7 @@ var withHistoryMethod = function withHistoryMethod(fn) {
|
|
|
47
43
|
};
|
|
48
44
|
};
|
|
49
45
|
var getMethod = withHistoryMethod(function (_ref) {
|
|
50
|
-
var inputMethod = _ref.inputMethod
|
|
51
|
-
sourceEvent = _ref.sourceEvent;
|
|
52
|
-
/**
|
|
53
|
-
* If sourceEvent is present, don't provide a custom method
|
|
54
|
-
*/
|
|
55
|
-
if (sourceEvent) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
46
|
+
var inputMethod = _ref.inputMethod;
|
|
58
47
|
switch (inputMethod) {
|
|
59
48
|
case _analytics.INPUT_METHOD.CLIPBOARD:
|
|
60
49
|
return 'editor_paste';
|
|
@@ -68,14 +57,7 @@ var getMethod = withHistoryMethod(function (_ref) {
|
|
|
68
57
|
}
|
|
69
58
|
});
|
|
70
59
|
var getUpdateType = withHistoryMethod(function (_ref2) {
|
|
71
|
-
var action = _ref2.action
|
|
72
|
-
sourceEvent = _ref2.sourceEvent;
|
|
73
|
-
/**
|
|
74
|
-
* If sourceEvent is present, don't provide a custom method
|
|
75
|
-
*/
|
|
76
|
-
if (sourceEvent) {
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
60
|
+
var action = _ref2.action;
|
|
79
61
|
switch (action) {
|
|
80
62
|
case _analytics.ACTION.CHANGED_TYPE:
|
|
81
63
|
return 'display_update';
|
|
@@ -124,11 +106,10 @@ var EventsBinding = function EventsBinding(_ref4) {
|
|
|
124
106
|
linkDeleted = _useSmartLinkLifecycl.linkDeleted;
|
|
125
107
|
var events = (0, _react.useMemo)(function () {
|
|
126
108
|
return {
|
|
127
|
-
created: function created(
|
|
128
|
-
var url =
|
|
129
|
-
display =
|
|
130
|
-
nodeContext =
|
|
131
|
-
metadata = (0, _objectWithoutProperties2.default)(_ref5, _excluded);
|
|
109
|
+
created: function created(metadata) {
|
|
110
|
+
var url = metadata.url,
|
|
111
|
+
display = metadata.display,
|
|
112
|
+
nodeContext = metadata.nodeContext;
|
|
132
113
|
var displayCategory = displayCategoryFromDisplay(display);
|
|
133
114
|
var sourceEvent = getSourceEventFromMetadata(metadata);
|
|
134
115
|
var creationMethod = getMethod(metadata);
|
|
@@ -141,12 +122,11 @@ var EventsBinding = function EventsBinding(_ref4) {
|
|
|
141
122
|
creationMethod: creationMethod
|
|
142
123
|
});
|
|
143
124
|
},
|
|
144
|
-
updated: function updated(
|
|
145
|
-
var url =
|
|
146
|
-
display =
|
|
147
|
-
previousDisplay =
|
|
148
|
-
nodeContext =
|
|
149
|
-
metadata = (0, _objectWithoutProperties2.default)(_ref6, _excluded2);
|
|
125
|
+
updated: function updated(metadata) {
|
|
126
|
+
var url = metadata.url,
|
|
127
|
+
display = metadata.display,
|
|
128
|
+
previousDisplay = metadata.previousDisplay,
|
|
129
|
+
nodeContext = metadata.nodeContext;
|
|
150
130
|
var displayCategory = displayCategoryFromDisplay(display);
|
|
151
131
|
var sourceEvent = getSourceEventFromMetadata(metadata);
|
|
152
132
|
var updateMethod = getMethod(metadata);
|
|
@@ -162,11 +142,10 @@ var EventsBinding = function EventsBinding(_ref4) {
|
|
|
162
142
|
updateType: updateType
|
|
163
143
|
});
|
|
164
144
|
},
|
|
165
|
-
deleted: function deleted(
|
|
166
|
-
var url =
|
|
167
|
-
display =
|
|
168
|
-
nodeContext =
|
|
169
|
-
metadata = (0, _objectWithoutProperties2.default)(_ref7, _excluded3);
|
|
145
|
+
deleted: function deleted(metadata) {
|
|
146
|
+
var url = metadata.url,
|
|
147
|
+
display = metadata.display,
|
|
148
|
+
nodeContext = metadata.nodeContext;
|
|
170
149
|
var displayCategory = displayCategoryFromDisplay(display);
|
|
171
150
|
var sourceEvent = getSourceEventFromMetadata(metadata);
|
|
172
151
|
var deleteMethod = getMethod(metadata);
|
|
@@ -221,6 +221,7 @@ var getToolbarConfig = function getToolbarConfig(options, featureFlags, pluginIn
|
|
|
221
221
|
var action = isEdit ? _analytics.ACTION.UPDATED : _analytics.ACTION.INSERTED;
|
|
222
222
|
var command = isEdit ? (0, _card.commandWithMetadata)((0, _commands.updateLink)(href, displayText || title, activeLinkMark.pos), {
|
|
223
223
|
action: action,
|
|
224
|
+
inputMethod: inputMethod,
|
|
224
225
|
sourceEvent: analytic
|
|
225
226
|
}) : (0, _commands.insertLinkWithAnalytics)(inputMethod, activeLinkMark.from, activeLinkMark.to, href, title, displayText, !!(options !== null && options !== void 0 && (_options$cardOptions = options.cardOptions) !== null && _options$cardOptions !== void 0 && _options$cardOptions.provider), analytic);
|
|
226
227
|
command(view.state, view.dispatch, view);
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.version = exports.nextMajorVersion = exports.name = void 0;
|
|
7
7
|
var name = "@atlaskit/editor-core";
|
|
8
8
|
exports.name = name;
|
|
9
|
-
var version = "185.12.
|
|
9
|
+
var version = "185.12.1";
|
|
10
10
|
exports.version = version;
|
|
11
11
|
var nextMajorVersion = function nextMajorVersion() {
|
|
12
12
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
package/dist/cjs/version.json
CHANGED
|
@@ -59,10 +59,10 @@ export class EditLinkToolbar extends React.Component {
|
|
|
59
59
|
,
|
|
60
60
|
invokeMethod: INPUT_METHOD.FLOATING_TB,
|
|
61
61
|
featureFlags: featureFlags,
|
|
62
|
-
onSubmit: (href, title, displayText,
|
|
62
|
+
onSubmit: (href, title, displayText, inputMethod, analytic) => {
|
|
63
63
|
this.hideLinkToolbar();
|
|
64
64
|
if (onSubmit) {
|
|
65
|
-
onSubmit(href, displayText || title, analytic);
|
|
65
|
+
onSubmit(href, displayText || title, inputMethod, analytic);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
});
|
|
@@ -111,7 +111,7 @@ export const buildEditLinkToolbar = ({
|
|
|
111
111
|
node: node,
|
|
112
112
|
featureFlags: featureFlags,
|
|
113
113
|
forceFocusSelector: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.floatingToolbar.actions) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.forceFocusSelector,
|
|
114
|
-
onSubmit: (newHref, newText, analytic) => {
|
|
114
|
+
onSubmit: (newHref, newText, inputMethod, analytic) => {
|
|
115
115
|
const urlChanged = newHref !== displayInfo.url;
|
|
116
116
|
const titleChanged = newText !== displayInfo.title;
|
|
117
117
|
|
|
@@ -121,6 +121,7 @@ export const buildEditLinkToolbar = ({
|
|
|
121
121
|
var _pluginInjectionApi$d2;
|
|
122
122
|
return commandWithMetadata(changeSelectedCardToLink(newText, newHref, undefined, undefined, undefined, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d2 = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.actions), {
|
|
123
123
|
action: ACTION.UPDATED,
|
|
124
|
+
inputMethod,
|
|
124
125
|
sourceEvent: analytic
|
|
125
126
|
})(view.state, view.dispatch);
|
|
126
127
|
}
|
|
@@ -29,15 +29,8 @@ const withHistoryMethod = fn => {
|
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
31
|
const getMethod = withHistoryMethod(({
|
|
32
|
-
inputMethod
|
|
33
|
-
sourceEvent
|
|
32
|
+
inputMethod
|
|
34
33
|
}) => {
|
|
35
|
-
/**
|
|
36
|
-
* If sourceEvent is present, don't provide a custom method
|
|
37
|
-
*/
|
|
38
|
-
if (sourceEvent) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
34
|
switch (inputMethod) {
|
|
42
35
|
case INPUT_METHOD.CLIPBOARD:
|
|
43
36
|
return 'editor_paste';
|
|
@@ -51,15 +44,8 @@ const getMethod = withHistoryMethod(({
|
|
|
51
44
|
}
|
|
52
45
|
});
|
|
53
46
|
const getUpdateType = withHistoryMethod(({
|
|
54
|
-
action
|
|
55
|
-
sourceEvent
|
|
47
|
+
action
|
|
56
48
|
}) => {
|
|
57
|
-
/**
|
|
58
|
-
* If sourceEvent is present, don't provide a custom method
|
|
59
|
-
*/
|
|
60
|
-
if (sourceEvent) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
49
|
switch (action) {
|
|
64
50
|
case ACTION.CHANGED_TYPE:
|
|
65
51
|
return 'display_update';
|
|
@@ -111,12 +97,12 @@ export const EventsBinding = ({
|
|
|
111
97
|
} = useSmartLinkLifecycleAnalytics();
|
|
112
98
|
const events = useMemo(() => {
|
|
113
99
|
return {
|
|
114
|
-
created:
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
100
|
+
created: metadata => {
|
|
101
|
+
const {
|
|
102
|
+
url,
|
|
103
|
+
display,
|
|
104
|
+
nodeContext
|
|
105
|
+
} = metadata;
|
|
120
106
|
const displayCategory = displayCategoryFromDisplay(display);
|
|
121
107
|
const sourceEvent = getSourceEventFromMetadata(metadata);
|
|
122
108
|
const creationMethod = getMethod(metadata);
|
|
@@ -129,13 +115,13 @@ export const EventsBinding = ({
|
|
|
129
115
|
creationMethod
|
|
130
116
|
});
|
|
131
117
|
},
|
|
132
|
-
updated:
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
118
|
+
updated: metadata => {
|
|
119
|
+
const {
|
|
120
|
+
url,
|
|
121
|
+
display,
|
|
122
|
+
previousDisplay,
|
|
123
|
+
nodeContext
|
|
124
|
+
} = metadata;
|
|
139
125
|
const displayCategory = displayCategoryFromDisplay(display);
|
|
140
126
|
const sourceEvent = getSourceEventFromMetadata(metadata);
|
|
141
127
|
const updateMethod = getMethod(metadata);
|
|
@@ -151,12 +137,12 @@ export const EventsBinding = ({
|
|
|
151
137
|
updateType
|
|
152
138
|
});
|
|
153
139
|
},
|
|
154
|
-
deleted:
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
140
|
+
deleted: metadata => {
|
|
141
|
+
const {
|
|
142
|
+
url,
|
|
143
|
+
display,
|
|
144
|
+
nodeContext
|
|
145
|
+
} = metadata;
|
|
160
146
|
const displayCategory = displayCategoryFromDisplay(display);
|
|
161
147
|
const sourceEvent = getSourceEventFromMetadata(metadata);
|
|
162
148
|
const deleteMethod = getMethod(metadata);
|
|
@@ -204,6 +204,7 @@ export const getToolbarConfig = (options, featureFlags, pluginInjectionApi) => (
|
|
|
204
204
|
const action = isEdit ? ACTION.UPDATED : ACTION.INSERTED;
|
|
205
205
|
const command = isEdit ? commandWithMetadata(updateLink(href, displayText || title, activeLinkMark.pos), {
|
|
206
206
|
action,
|
|
207
|
+
inputMethod,
|
|
207
208
|
sourceEvent: analytic
|
|
208
209
|
}) : insertLinkWithAnalytics(inputMethod, activeLinkMark.from, activeLinkMark.to, href, title, displayText, !!(options !== null && options !== void 0 && (_options$cardOptions = options.cardOptions) !== null && _options$cardOptions !== void 0 && _options$cardOptions.provider), analytic);
|
|
209
210
|
command(view.state, view.dispatch, view);
|
package/dist/es2019/version.json
CHANGED
|
@@ -81,10 +81,10 @@ export var EditLinkToolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
81
81
|
,
|
|
82
82
|
invokeMethod: INPUT_METHOD.FLOATING_TB,
|
|
83
83
|
featureFlags: featureFlags,
|
|
84
|
-
onSubmit: function onSubmit(href, title, displayText,
|
|
84
|
+
onSubmit: function onSubmit(href, title, displayText, inputMethod, analytic) {
|
|
85
85
|
_this2.hideLinkToolbar();
|
|
86
86
|
if (_onSubmit) {
|
|
87
|
-
_onSubmit(href, displayText || title, analytic);
|
|
87
|
+
_onSubmit(href, displayText || title, inputMethod, analytic);
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
});
|
|
@@ -134,7 +134,7 @@ export var buildEditLinkToolbar = function buildEditLinkToolbar(_ref) {
|
|
|
134
134
|
node: node,
|
|
135
135
|
featureFlags: featureFlags,
|
|
136
136
|
forceFocusSelector: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.floatingToolbar.actions) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.forceFocusSelector,
|
|
137
|
-
onSubmit: function onSubmit(newHref, newText, analytic) {
|
|
137
|
+
onSubmit: function onSubmit(newHref, newText, inputMethod, analytic) {
|
|
138
138
|
var urlChanged = newHref !== displayInfo.url;
|
|
139
139
|
var titleChanged = newText !== displayInfo.title;
|
|
140
140
|
|
|
@@ -144,6 +144,7 @@ export var buildEditLinkToolbar = function buildEditLinkToolbar(_ref) {
|
|
|
144
144
|
var _pluginInjectionApi$d2;
|
|
145
145
|
return commandWithMetadata(changeSelectedCardToLink(newText, newHref, undefined, undefined, undefined, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d2 = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.actions), {
|
|
146
146
|
action: ACTION.UPDATED,
|
|
147
|
+
inputMethod: inputMethod,
|
|
147
148
|
sourceEvent: analytic
|
|
148
149
|
})(view.state, view.dispatch);
|
|
149
150
|
}
|
|
@@ -4,10 +4,6 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
4
4
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
5
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
6
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
7
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
8
|
-
var _excluded = ["url", "display", "nodeContext"],
|
|
9
|
-
_excluded2 = ["url", "display", "previousDisplay", "nodeContext"],
|
|
10
|
-
_excluded3 = ["url", "display", "nodeContext"];
|
|
11
7
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
12
8
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
13
9
|
import React from 'react';
|
|
@@ -38,14 +34,7 @@ var withHistoryMethod = function withHistoryMethod(fn) {
|
|
|
38
34
|
};
|
|
39
35
|
};
|
|
40
36
|
var getMethod = withHistoryMethod(function (_ref) {
|
|
41
|
-
var inputMethod = _ref.inputMethod
|
|
42
|
-
sourceEvent = _ref.sourceEvent;
|
|
43
|
-
/**
|
|
44
|
-
* If sourceEvent is present, don't provide a custom method
|
|
45
|
-
*/
|
|
46
|
-
if (sourceEvent) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
37
|
+
var inputMethod = _ref.inputMethod;
|
|
49
38
|
switch (inputMethod) {
|
|
50
39
|
case INPUT_METHOD.CLIPBOARD:
|
|
51
40
|
return 'editor_paste';
|
|
@@ -59,14 +48,7 @@ var getMethod = withHistoryMethod(function (_ref) {
|
|
|
59
48
|
}
|
|
60
49
|
});
|
|
61
50
|
var getUpdateType = withHistoryMethod(function (_ref2) {
|
|
62
|
-
var action = _ref2.action
|
|
63
|
-
sourceEvent = _ref2.sourceEvent;
|
|
64
|
-
/**
|
|
65
|
-
* If sourceEvent is present, don't provide a custom method
|
|
66
|
-
*/
|
|
67
|
-
if (sourceEvent) {
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
51
|
+
var action = _ref2.action;
|
|
70
52
|
switch (action) {
|
|
71
53
|
case ACTION.CHANGED_TYPE:
|
|
72
54
|
return 'display_update';
|
|
@@ -115,11 +97,10 @@ export var EventsBinding = function EventsBinding(_ref4) {
|
|
|
115
97
|
linkDeleted = _useSmartLinkLifecycl.linkDeleted;
|
|
116
98
|
var events = useMemo(function () {
|
|
117
99
|
return {
|
|
118
|
-
created: function created(
|
|
119
|
-
var url =
|
|
120
|
-
display =
|
|
121
|
-
nodeContext =
|
|
122
|
-
metadata = _objectWithoutProperties(_ref5, _excluded);
|
|
100
|
+
created: function created(metadata) {
|
|
101
|
+
var url = metadata.url,
|
|
102
|
+
display = metadata.display,
|
|
103
|
+
nodeContext = metadata.nodeContext;
|
|
123
104
|
var displayCategory = displayCategoryFromDisplay(display);
|
|
124
105
|
var sourceEvent = getSourceEventFromMetadata(metadata);
|
|
125
106
|
var creationMethod = getMethod(metadata);
|
|
@@ -132,12 +113,11 @@ export var EventsBinding = function EventsBinding(_ref4) {
|
|
|
132
113
|
creationMethod: creationMethod
|
|
133
114
|
});
|
|
134
115
|
},
|
|
135
|
-
updated: function updated(
|
|
136
|
-
var url =
|
|
137
|
-
display =
|
|
138
|
-
previousDisplay =
|
|
139
|
-
nodeContext =
|
|
140
|
-
metadata = _objectWithoutProperties(_ref6, _excluded2);
|
|
116
|
+
updated: function updated(metadata) {
|
|
117
|
+
var url = metadata.url,
|
|
118
|
+
display = metadata.display,
|
|
119
|
+
previousDisplay = metadata.previousDisplay,
|
|
120
|
+
nodeContext = metadata.nodeContext;
|
|
141
121
|
var displayCategory = displayCategoryFromDisplay(display);
|
|
142
122
|
var sourceEvent = getSourceEventFromMetadata(metadata);
|
|
143
123
|
var updateMethod = getMethod(metadata);
|
|
@@ -153,11 +133,10 @@ export var EventsBinding = function EventsBinding(_ref4) {
|
|
|
153
133
|
updateType: updateType
|
|
154
134
|
});
|
|
155
135
|
},
|
|
156
|
-
deleted: function deleted(
|
|
157
|
-
var url =
|
|
158
|
-
display =
|
|
159
|
-
nodeContext =
|
|
160
|
-
metadata = _objectWithoutProperties(_ref7, _excluded3);
|
|
136
|
+
deleted: function deleted(metadata) {
|
|
137
|
+
var url = metadata.url,
|
|
138
|
+
display = metadata.display,
|
|
139
|
+
nodeContext = metadata.nodeContext;
|
|
161
140
|
var displayCategory = displayCategoryFromDisplay(display);
|
|
162
141
|
var sourceEvent = getSourceEventFromMetadata(metadata);
|
|
163
142
|
var deleteMethod = getMethod(metadata);
|
|
@@ -215,6 +215,7 @@ export var getToolbarConfig = function getToolbarConfig(options, featureFlags, p
|
|
|
215
215
|
var action = isEdit ? ACTION.UPDATED : ACTION.INSERTED;
|
|
216
216
|
var command = isEdit ? commandWithMetadata(updateLink(href, displayText || title, activeLinkMark.pos), {
|
|
217
217
|
action: action,
|
|
218
|
+
inputMethod: inputMethod,
|
|
218
219
|
sourceEvent: analytic
|
|
219
220
|
}) : insertLinkWithAnalytics(inputMethod, activeLinkMark.from, activeLinkMark.to, href, title, displayText, !!(options !== null && options !== void 0 && (_options$cardOptions = options.cardOptions) !== null && _options$cardOptions !== void 0 && _options$cardOptions.provider), analytic);
|
|
220
221
|
command(view.state, view.dispatch, view);
|
package/dist/esm/version.json
CHANGED
|
@@ -64,7 +64,7 @@ export type Request = {
|
|
|
64
64
|
*/
|
|
65
65
|
sourceEvent?: UIAnalyticsEvent | null | undefined;
|
|
66
66
|
};
|
|
67
|
-
type Metadata<T = {}> = {
|
|
67
|
+
export type Metadata<T = {}> = {
|
|
68
68
|
url: string;
|
|
69
69
|
display: string;
|
|
70
70
|
isUndo?: boolean;
|
|
@@ -74,7 +74,7 @@ type Metadata<T = {}> = {
|
|
|
74
74
|
sourceEvent?: unknown;
|
|
75
75
|
nodeContext?: string;
|
|
76
76
|
} & T;
|
|
77
|
-
type UpdateMetadata = {
|
|
77
|
+
export type UpdateMetadata = {
|
|
78
78
|
previousDisplay?: string;
|
|
79
79
|
};
|
|
80
80
|
export type SmartLinkEventsNext = {
|
|
@@ -162,4 +162,3 @@ export type SetCardLayoutAndDatasourceTableRef = {
|
|
|
162
162
|
datasourceTableRef?: HTMLElement;
|
|
163
163
|
};
|
|
164
164
|
export type CardPluginAction = SetProvider | Queue | Resolve | Register | ShowLinkToolbar | HideLinkToolbar | ShowDatasourceModal | HideDatasourceModal | RegisterSmartCardEvents | RegisterSmartCardEventsNext | SetDatasourceTableRef | SetCardLayout | SetCardLayoutAndDatasourceTableRef;
|
|
165
|
-
export {};
|
|
@@ -4,7 +4,7 @@ import { EditorState } from 'prosemirror-state';
|
|
|
4
4
|
import { EditorView } from 'prosemirror-view';
|
|
5
5
|
import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
6
6
|
import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
7
|
-
import type { LinkPickerOptions } from '@atlaskit/editor-common/types';
|
|
7
|
+
import type { LinkInputType, LinkPickerOptions } from '@atlaskit/editor-common/types';
|
|
8
8
|
import type { Command, FloatingToolbarItem, FloatingToolbarConfig, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
9
9
|
import { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
10
10
|
import { FeatureFlags } from '@atlaskit/editor-common/types';
|
|
@@ -16,7 +16,7 @@ export type EditLinkToolbarProps = {
|
|
|
16
16
|
url: string | undefined;
|
|
17
17
|
text: string;
|
|
18
18
|
node: Node;
|
|
19
|
-
onSubmit?: (href: string, text?: string, analytic?: UIAnalyticsEvent | null | undefined) => void;
|
|
19
|
+
onSubmit?: (href: string, text?: string, inputMethod?: LinkInputType, analytic?: UIAnalyticsEvent | null | undefined) => void;
|
|
20
20
|
linkPickerOptions?: LinkPickerOptions;
|
|
21
21
|
featureFlags: FeatureFlags;
|
|
22
22
|
forceFocusSelector: ForceFocusSelector | undefined;
|
|
@@ -64,7 +64,7 @@ export type Request = {
|
|
|
64
64
|
*/
|
|
65
65
|
sourceEvent?: UIAnalyticsEvent | null | undefined;
|
|
66
66
|
};
|
|
67
|
-
type Metadata<T = {}> = {
|
|
67
|
+
export type Metadata<T = {}> = {
|
|
68
68
|
url: string;
|
|
69
69
|
display: string;
|
|
70
70
|
isUndo?: boolean;
|
|
@@ -74,7 +74,7 @@ type Metadata<T = {}> = {
|
|
|
74
74
|
sourceEvent?: unknown;
|
|
75
75
|
nodeContext?: string;
|
|
76
76
|
} & T;
|
|
77
|
-
type UpdateMetadata = {
|
|
77
|
+
export type UpdateMetadata = {
|
|
78
78
|
previousDisplay?: string;
|
|
79
79
|
};
|
|
80
80
|
export type SmartLinkEventsNext = {
|
|
@@ -162,4 +162,3 @@ export type SetCardLayoutAndDatasourceTableRef = {
|
|
|
162
162
|
datasourceTableRef?: HTMLElement;
|
|
163
163
|
};
|
|
164
164
|
export type CardPluginAction = SetProvider | Queue | Resolve | Register | ShowLinkToolbar | HideLinkToolbar | ShowDatasourceModal | HideDatasourceModal | RegisterSmartCardEvents | RegisterSmartCardEventsNext | SetDatasourceTableRef | SetCardLayout | SetCardLayoutAndDatasourceTableRef;
|
|
165
|
-
export {};
|
|
@@ -4,7 +4,7 @@ import { EditorState } from 'prosemirror-state';
|
|
|
4
4
|
import { EditorView } from 'prosemirror-view';
|
|
5
5
|
import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
6
6
|
import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
7
|
-
import type { LinkPickerOptions } from '@atlaskit/editor-common/types';
|
|
7
|
+
import type { LinkInputType, LinkPickerOptions } from '@atlaskit/editor-common/types';
|
|
8
8
|
import type { Command, FloatingToolbarItem, FloatingToolbarConfig, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
9
9
|
import { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
10
10
|
import { FeatureFlags } from '@atlaskit/editor-common/types';
|
|
@@ -16,7 +16,7 @@ export type EditLinkToolbarProps = {
|
|
|
16
16
|
url: string | undefined;
|
|
17
17
|
text: string;
|
|
18
18
|
node: Node;
|
|
19
|
-
onSubmit?: (href: string, text?: string, analytic?: UIAnalyticsEvent | null | undefined) => void;
|
|
19
|
+
onSubmit?: (href: string, text?: string, inputMethod?: LinkInputType, analytic?: UIAnalyticsEvent | null | undefined) => void;
|
|
20
20
|
linkPickerOptions?: LinkPickerOptions;
|
|
21
21
|
featureFlags: FeatureFlags;
|
|
22
22
|
forceFocusSelector: ForceFocusSelector | undefined;
|