@atlaskit/editor-core 189.6.23 → 189.6.24
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/extension/nodeviews/extension.js +2 -1
- package/dist/cjs/plugins/extension/ui/Extension/ExtensionComponent.js +4 -2
- package/dist/cjs/plugins/extension/ui/Extension/MultiBodiedExtension/index.js +34 -4
- package/dist/cjs/plugins/extension/ui/Extension/index.js +4 -2
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/plugins/extension/nodeviews/extension.js +2 -1
- package/dist/es2019/plugins/extension/ui/Extension/ExtensionComponent.js +4 -2
- package/dist/es2019/plugins/extension/ui/Extension/MultiBodiedExtension/index.js +34 -4
- package/dist/es2019/plugins/extension/ui/Extension/index.js +4 -2
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/plugins/extension/nodeviews/extension.js +2 -1
- package/dist/esm/plugins/extension/ui/Extension/ExtensionComponent.js +4 -2
- package/dist/esm/plugins/extension/ui/Extension/MultiBodiedExtension/index.js +34 -4
- package/dist/esm/plugins/extension/ui/Extension/index.js +4 -2
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/plugins/extension/ui/Extension/ExtensionComponent.d.ts +2 -0
- package/dist/types/plugins/extension/ui/Extension/MultiBodiedExtension/index.d.ts +3 -1
- package/dist/types/plugins/extension/ui/Extension/index.d.ts +2 -0
- package/dist/types-ts4.5/plugins/extension/ui/Extension/ExtensionComponent.d.ts +2 -0
- package/dist/types-ts4.5/plugins/extension/ui/Extension/MultiBodiedExtension/index.d.ts +3 -1
- package/dist/types-ts4.5/plugins/extension/ui/Extension/index.d.ts +2 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 189.6.24
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#60182](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/60182) [`a2d430ec4462`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a2d430ec4462) - ED-21373 Initial changes for MBE analytics events
|
|
8
|
+
|
|
3
9
|
## 189.6.23
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -58,7 +58,8 @@ var ExtensionNode = exports.ExtensionNode = /*#__PURE__*/function (_ReactNodeVie
|
|
|
58
58
|
nodeType: this.node.type.name
|
|
59
59
|
}, /*#__PURE__*/_react.default.createElement(_Extension.default, {
|
|
60
60
|
editorView: this.view,
|
|
61
|
-
node: this.node
|
|
61
|
+
node: this.node,
|
|
62
|
+
eventDispatcher: this.eventDispatcher
|
|
62
63
|
// The getPos arg is always a function when used with nodes
|
|
63
64
|
// the version of the types we use has a union with the type
|
|
64
65
|
// for marks.
|
|
@@ -192,14 +192,16 @@ var ExtensionComponent = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
192
192
|
references = _this$props2.references,
|
|
193
193
|
editorAppearance = _this$props2.editorAppearance,
|
|
194
194
|
pluginInjectionApi = _this$props2.pluginInjectionApi,
|
|
195
|
-
getPos = _this$props2.getPos
|
|
195
|
+
getPos = _this$props2.getPos,
|
|
196
|
+
eventDispatcher = _this$props2.eventDispatcher;
|
|
196
197
|
if (node.type.name === 'multiBodiedExtension') {
|
|
197
198
|
return /*#__PURE__*/_react.default.createElement(_MultiBodiedExtension.default, {
|
|
198
199
|
node: node,
|
|
199
200
|
editorView: editorView,
|
|
200
201
|
getPos: getPos,
|
|
201
202
|
handleContentDOMRef: handleContentDOMRef,
|
|
202
|
-
tryExtensionHandler: this.tryExtensionHandler.bind(this)
|
|
203
|
+
tryExtensionHandler: this.tryExtensionHandler.bind(this),
|
|
204
|
+
eventDispatcher: eventDispatcher
|
|
203
205
|
});
|
|
204
206
|
}
|
|
205
207
|
var extensionHandlerResult = this.tryExtensionHandler(undefined);
|
|
@@ -12,6 +12,9 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
12
12
|
var _react = require("@emotion/react");
|
|
13
13
|
var _colors = require("@atlaskit/theme/colors");
|
|
14
14
|
var _react2 = _interopRequireWildcard(require("react"));
|
|
15
|
+
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
16
|
+
var _eventDispatcher = require("@atlaskit/editor-common/event-dispatcher");
|
|
17
|
+
var _utils = require("@atlaskit/editor-common/utils");
|
|
15
18
|
var _templateObject, _templateObject2;
|
|
16
19
|
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); }
|
|
17
20
|
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; }
|
|
@@ -21,11 +24,16 @@ var useMultiBodiedExtensionActions = function useMultiBodiedExtensionActions(_re
|
|
|
21
24
|
var updateActiveChild = _ref.updateActiveChild,
|
|
22
25
|
editorView = _ref.editorView,
|
|
23
26
|
getPos = _ref.getPos,
|
|
24
|
-
node = _ref.node
|
|
27
|
+
node = _ref.node,
|
|
28
|
+
eventDispatcher = _ref.eventDispatcher;
|
|
25
29
|
var actions = _react2.default.useMemo(function () {
|
|
26
30
|
return {
|
|
27
31
|
changeActive: function changeActive(index) {
|
|
28
|
-
|
|
32
|
+
var updateActiveChildResult = updateActiveChild(index);
|
|
33
|
+
if (eventDispatcher) {
|
|
34
|
+
sendMBEAnalyticsEvent(_analytics.ACTION.CHANGE_ACTIVE, node, eventDispatcher);
|
|
35
|
+
}
|
|
36
|
+
return updateActiveChildResult;
|
|
29
37
|
},
|
|
30
38
|
addChild: function addChild() {
|
|
31
39
|
var state = editorView.state,
|
|
@@ -44,6 +52,9 @@ var useMultiBodiedExtensionActions = function useMultiBodiedExtensionActions(_re
|
|
|
44
52
|
}
|
|
45
53
|
var insertAt = Math.min((pos || 1) + node.content.size, state.doc.content.size);
|
|
46
54
|
dispatch(state.tr.insert(insertAt, frame));
|
|
55
|
+
if (eventDispatcher) {
|
|
56
|
+
sendMBEAnalyticsEvent(_analytics.ACTION.ADD_CHILD, node, eventDispatcher);
|
|
57
|
+
}
|
|
47
58
|
return true;
|
|
48
59
|
},
|
|
49
60
|
getChildrenCount: function getChildrenCount() {
|
|
@@ -102,7 +113,7 @@ var useMultiBodiedExtensionActions = function useMultiBodiedExtensionActions(_re
|
|
|
102
113
|
return children ? children.toJSON() : [];
|
|
103
114
|
}
|
|
104
115
|
};
|
|
105
|
-
}, [node, editorView, getPos, updateActiveChild]);
|
|
116
|
+
}, [node, editorView, getPos, updateActiveChild, eventDispatcher]);
|
|
106
117
|
return actions;
|
|
107
118
|
};
|
|
108
119
|
var navigationCSS = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n // make sure the user can't see a range selection inside the navigation\n // This is really important to keep the navigation working properly\n user-select: none;\n -webkit-user-modify: read-only;\n border: 1px solid ", ";\n background-color: ", ";\n"])), "var(--ds-border, ".concat(_colors.N40, ")"), "var(--ds-background-inverse-subtle, ".concat(_colors.N50, ")"));
|
|
@@ -111,7 +122,8 @@ var MultiBodiedExtension = function MultiBodiedExtension(_ref2) {
|
|
|
111
122
|
handleContentDOMRef = _ref2.handleContentDOMRef,
|
|
112
123
|
getPos = _ref2.getPos,
|
|
113
124
|
tryExtensionHandler = _ref2.tryExtensionHandler,
|
|
114
|
-
editorView = _ref2.editorView
|
|
125
|
+
editorView = _ref2.editorView,
|
|
126
|
+
eventDispatcher = _ref2.eventDispatcher;
|
|
115
127
|
var _useState = (0, _react2.useState)(0),
|
|
116
128
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
117
129
|
activeChildIndex = _useState2[0],
|
|
@@ -129,6 +141,7 @@ var MultiBodiedExtension = function MultiBodiedExtension(_ref2) {
|
|
|
129
141
|
updateActiveChild: updateActiveChild,
|
|
130
142
|
editorView: editorView,
|
|
131
143
|
getPos: getPos,
|
|
144
|
+
eventDispatcher: eventDispatcher,
|
|
132
145
|
node: node
|
|
133
146
|
});
|
|
134
147
|
var extensionHandlerResult = _react2.default.useMemo(function () {
|
|
@@ -153,4 +166,21 @@ var MultiBodiedExtension = function MultiBodiedExtension(_ref2) {
|
|
|
153
166
|
ref: articleRef
|
|
154
167
|
}));
|
|
155
168
|
};
|
|
169
|
+
var sendMBEAnalyticsEvent = function sendMBEAnalyticsEvent(action, node, eventDispatcher) {
|
|
170
|
+
var analyticsDispatch = (0, _eventDispatcher.createDispatch)(eventDispatcher);
|
|
171
|
+
analyticsDispatch(_utils.analyticsEventKey, {
|
|
172
|
+
payload: {
|
|
173
|
+
action: action,
|
|
174
|
+
actionSubject: _analytics.ACTION_SUBJECT.MULTI_BODIED_EXTENSION,
|
|
175
|
+
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
176
|
+
attributes: {
|
|
177
|
+
extensionType: node.attrs.extensionType,
|
|
178
|
+
extensionKey: node.attrs.extensionKey,
|
|
179
|
+
localId: node.attrs.localId,
|
|
180
|
+
maxFramesCount: node.attrs.maxFrames,
|
|
181
|
+
currentFramesCount: node.content.childCount
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
};
|
|
156
186
|
var _default = exports.default = MultiBodiedExtension;
|
|
@@ -37,7 +37,8 @@ var Extension = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
37
37
|
extensionHandlers = _this$props.extensionHandlers,
|
|
38
38
|
references = _this$props.references,
|
|
39
39
|
editorAppearance = _this$props.editorAppearance,
|
|
40
|
-
pluginInjectionApi = _this$props.pluginInjectionApi
|
|
40
|
+
pluginInjectionApi = _this$props.pluginInjectionApi,
|
|
41
|
+
eventDispatcher = _this$props.eventDispatcher;
|
|
41
42
|
return /*#__PURE__*/_react.default.createElement(_ExtensionComponent.default, {
|
|
42
43
|
editorView: editorView,
|
|
43
44
|
node: node,
|
|
@@ -47,7 +48,8 @@ var Extension = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
47
48
|
handleContentDOMRef: handleContentDOMRef,
|
|
48
49
|
extensionHandlers: extensionHandlers,
|
|
49
50
|
editorAppearance: editorAppearance,
|
|
50
|
-
pluginInjectionApi: pluginInjectionApi
|
|
51
|
+
pluginInjectionApi: pluginInjectionApi,
|
|
52
|
+
eventDispatcher: eventDispatcher
|
|
51
53
|
});
|
|
52
54
|
});
|
|
53
55
|
_this.providerFactory = props.providerFactory || new _providerFactory.ProviderFactory();
|
|
@@ -31,7 +31,8 @@ export class ExtensionNode extends ReactNodeView {
|
|
|
31
31
|
nodeType: this.node.type.name
|
|
32
32
|
}, /*#__PURE__*/React.createElement(Extension, {
|
|
33
33
|
editorView: this.view,
|
|
34
|
-
node: this.node
|
|
34
|
+
node: this.node,
|
|
35
|
+
eventDispatcher: this.eventDispatcher
|
|
35
36
|
// The getPos arg is always a function when used with nodes
|
|
36
37
|
// the version of the types we use has a union with the type
|
|
37
38
|
// for marks.
|
|
@@ -145,7 +145,8 @@ export default class ExtensionComponent extends Component {
|
|
|
145
145
|
references,
|
|
146
146
|
editorAppearance,
|
|
147
147
|
pluginInjectionApi,
|
|
148
|
-
getPos
|
|
148
|
+
getPos,
|
|
149
|
+
eventDispatcher
|
|
149
150
|
} = this.props;
|
|
150
151
|
if (node.type.name === 'multiBodiedExtension') {
|
|
151
152
|
return /*#__PURE__*/React.createElement(MultiBodiedExtension, {
|
|
@@ -153,7 +154,8 @@ export default class ExtensionComponent extends Component {
|
|
|
153
154
|
editorView: editorView,
|
|
154
155
|
getPos: getPos,
|
|
155
156
|
handleContentDOMRef: handleContentDOMRef,
|
|
156
|
-
tryExtensionHandler: this.tryExtensionHandler.bind(this)
|
|
157
|
+
tryExtensionHandler: this.tryExtensionHandler.bind(this),
|
|
158
|
+
eventDispatcher: eventDispatcher
|
|
157
159
|
});
|
|
158
160
|
}
|
|
159
161
|
const extensionHandlerResult = this.tryExtensionHandler(undefined);
|
|
@@ -3,16 +3,24 @@
|
|
|
3
3
|
import { jsx, css } from '@emotion/react';
|
|
4
4
|
import { N30, N40, N50 } from '@atlaskit/theme/colors';
|
|
5
5
|
import React, { useState } from 'react';
|
|
6
|
+
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
7
|
+
import { createDispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
8
|
+
import { analyticsEventKey } from '@atlaskit/editor-common/utils';
|
|
6
9
|
const useMultiBodiedExtensionActions = ({
|
|
7
10
|
updateActiveChild,
|
|
8
11
|
editorView,
|
|
9
12
|
getPos,
|
|
10
|
-
node
|
|
13
|
+
node,
|
|
14
|
+
eventDispatcher
|
|
11
15
|
}) => {
|
|
12
16
|
const actions = React.useMemo(() => {
|
|
13
17
|
return {
|
|
14
18
|
changeActive(index) {
|
|
15
|
-
|
|
19
|
+
const updateActiveChildResult = updateActiveChild(index);
|
|
20
|
+
if (eventDispatcher) {
|
|
21
|
+
sendMBEAnalyticsEvent(ACTION.CHANGE_ACTIVE, node, eventDispatcher);
|
|
22
|
+
}
|
|
23
|
+
return updateActiveChildResult;
|
|
16
24
|
},
|
|
17
25
|
addChild() {
|
|
18
26
|
const {
|
|
@@ -33,6 +41,9 @@ const useMultiBodiedExtensionActions = ({
|
|
|
33
41
|
}
|
|
34
42
|
const insertAt = Math.min((pos || 1) + node.content.size, state.doc.content.size);
|
|
35
43
|
dispatch(state.tr.insert(insertAt, frame));
|
|
44
|
+
if (eventDispatcher) {
|
|
45
|
+
sendMBEAnalyticsEvent(ACTION.ADD_CHILD, node, eventDispatcher);
|
|
46
|
+
}
|
|
36
47
|
return true;
|
|
37
48
|
},
|
|
38
49
|
getChildrenCount() {
|
|
@@ -99,7 +110,7 @@ const useMultiBodiedExtensionActions = ({
|
|
|
99
110
|
return children ? children.toJSON() : [];
|
|
100
111
|
}
|
|
101
112
|
};
|
|
102
|
-
}, [node, editorView, getPos, updateActiveChild]);
|
|
113
|
+
}, [node, editorView, getPos, updateActiveChild, eventDispatcher]);
|
|
103
114
|
return actions;
|
|
104
115
|
};
|
|
105
116
|
const navigationCSS = css`
|
|
@@ -115,7 +126,8 @@ const MultiBodiedExtension = ({
|
|
|
115
126
|
handleContentDOMRef,
|
|
116
127
|
getPos,
|
|
117
128
|
tryExtensionHandler,
|
|
118
|
-
editorView
|
|
129
|
+
editorView,
|
|
130
|
+
eventDispatcher
|
|
119
131
|
}) => {
|
|
120
132
|
const [activeChildIndex, setActiveChildIndex] = useState(0);
|
|
121
133
|
// Adding to avoid aliasing `this` for the callbacks
|
|
@@ -131,6 +143,7 @@ const MultiBodiedExtension = ({
|
|
|
131
143
|
updateActiveChild,
|
|
132
144
|
editorView,
|
|
133
145
|
getPos,
|
|
146
|
+
eventDispatcher,
|
|
134
147
|
node
|
|
135
148
|
});
|
|
136
149
|
const extensionHandlerResult = React.useMemo(() => {
|
|
@@ -168,4 +181,21 @@ const MultiBodiedExtension = ({
|
|
|
168
181
|
ref: articleRef
|
|
169
182
|
}));
|
|
170
183
|
};
|
|
184
|
+
const sendMBEAnalyticsEvent = (action, node, eventDispatcher) => {
|
|
185
|
+
const analyticsDispatch = createDispatch(eventDispatcher);
|
|
186
|
+
analyticsDispatch(analyticsEventKey, {
|
|
187
|
+
payload: {
|
|
188
|
+
action,
|
|
189
|
+
actionSubject: ACTION_SUBJECT.MULTI_BODIED_EXTENSION,
|
|
190
|
+
eventType: EVENT_TYPE.TRACK,
|
|
191
|
+
attributes: {
|
|
192
|
+
extensionType: node.attrs.extensionType,
|
|
193
|
+
extensionKey: node.attrs.extensionKey,
|
|
194
|
+
localId: node.attrs.localId,
|
|
195
|
+
maxFramesCount: node.attrs.maxFrames,
|
|
196
|
+
currentFramesCount: node.content.childCount
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
};
|
|
171
201
|
export default MultiBodiedExtension;
|
|
@@ -17,7 +17,8 @@ export default class Extension extends Component {
|
|
|
17
17
|
extensionHandlers,
|
|
18
18
|
references,
|
|
19
19
|
editorAppearance,
|
|
20
|
-
pluginInjectionApi
|
|
20
|
+
pluginInjectionApi,
|
|
21
|
+
eventDispatcher
|
|
21
22
|
} = this.props;
|
|
22
23
|
return /*#__PURE__*/React.createElement(ExtensionComponent, {
|
|
23
24
|
editorView: editorView,
|
|
@@ -28,7 +29,8 @@ export default class Extension extends Component {
|
|
|
28
29
|
handleContentDOMRef: handleContentDOMRef,
|
|
29
30
|
extensionHandlers: extensionHandlers,
|
|
30
31
|
editorAppearance: editorAppearance,
|
|
31
|
-
pluginInjectionApi: pluginInjectionApi
|
|
32
|
+
pluginInjectionApi: pluginInjectionApi,
|
|
33
|
+
eventDispatcher: eventDispatcher
|
|
32
34
|
});
|
|
33
35
|
});
|
|
34
36
|
this.providerFactory = props.providerFactory || new ProviderFactory();
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = "@atlaskit/editor-core";
|
|
2
|
-
export const version = "189.6.
|
|
2
|
+
export const version = "189.6.24";
|
|
@@ -50,7 +50,8 @@ export var ExtensionNode = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
50
50
|
nodeType: this.node.type.name
|
|
51
51
|
}, /*#__PURE__*/React.createElement(Extension, {
|
|
52
52
|
editorView: this.view,
|
|
53
|
-
node: this.node
|
|
53
|
+
node: this.node,
|
|
54
|
+
eventDispatcher: this.eventDispatcher
|
|
54
55
|
// The getPos arg is always a function when used with nodes
|
|
55
56
|
// the version of the types we use has a union with the type
|
|
56
57
|
// for marks.
|
|
@@ -183,14 +183,16 @@ var ExtensionComponent = /*#__PURE__*/function (_Component) {
|
|
|
183
183
|
references = _this$props2.references,
|
|
184
184
|
editorAppearance = _this$props2.editorAppearance,
|
|
185
185
|
pluginInjectionApi = _this$props2.pluginInjectionApi,
|
|
186
|
-
getPos = _this$props2.getPos
|
|
186
|
+
getPos = _this$props2.getPos,
|
|
187
|
+
eventDispatcher = _this$props2.eventDispatcher;
|
|
187
188
|
if (node.type.name === 'multiBodiedExtension') {
|
|
188
189
|
return /*#__PURE__*/React.createElement(MultiBodiedExtension, {
|
|
189
190
|
node: node,
|
|
190
191
|
editorView: editorView,
|
|
191
192
|
getPos: getPos,
|
|
192
193
|
handleContentDOMRef: handleContentDOMRef,
|
|
193
|
-
tryExtensionHandler: this.tryExtensionHandler.bind(this)
|
|
194
|
+
tryExtensionHandler: this.tryExtensionHandler.bind(this),
|
|
195
|
+
eventDispatcher: eventDispatcher
|
|
194
196
|
});
|
|
195
197
|
}
|
|
196
198
|
var extensionHandlerResult = this.tryExtensionHandler(undefined);
|
|
@@ -9,15 +9,23 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
9
9
|
import { jsx, css } from '@emotion/react';
|
|
10
10
|
import { N30, N40, N50 } from '@atlaskit/theme/colors';
|
|
11
11
|
import React, { useState } from 'react';
|
|
12
|
+
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
13
|
+
import { createDispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
14
|
+
import { analyticsEventKey } from '@atlaskit/editor-common/utils';
|
|
12
15
|
var useMultiBodiedExtensionActions = function useMultiBodiedExtensionActions(_ref) {
|
|
13
16
|
var updateActiveChild = _ref.updateActiveChild,
|
|
14
17
|
editorView = _ref.editorView,
|
|
15
18
|
getPos = _ref.getPos,
|
|
16
|
-
node = _ref.node
|
|
19
|
+
node = _ref.node,
|
|
20
|
+
eventDispatcher = _ref.eventDispatcher;
|
|
17
21
|
var actions = React.useMemo(function () {
|
|
18
22
|
return {
|
|
19
23
|
changeActive: function changeActive(index) {
|
|
20
|
-
|
|
24
|
+
var updateActiveChildResult = updateActiveChild(index);
|
|
25
|
+
if (eventDispatcher) {
|
|
26
|
+
sendMBEAnalyticsEvent(ACTION.CHANGE_ACTIVE, node, eventDispatcher);
|
|
27
|
+
}
|
|
28
|
+
return updateActiveChildResult;
|
|
21
29
|
},
|
|
22
30
|
addChild: function addChild() {
|
|
23
31
|
var state = editorView.state,
|
|
@@ -36,6 +44,9 @@ var useMultiBodiedExtensionActions = function useMultiBodiedExtensionActions(_re
|
|
|
36
44
|
}
|
|
37
45
|
var insertAt = Math.min((pos || 1) + node.content.size, state.doc.content.size);
|
|
38
46
|
dispatch(state.tr.insert(insertAt, frame));
|
|
47
|
+
if (eventDispatcher) {
|
|
48
|
+
sendMBEAnalyticsEvent(ACTION.ADD_CHILD, node, eventDispatcher);
|
|
49
|
+
}
|
|
39
50
|
return true;
|
|
40
51
|
},
|
|
41
52
|
getChildrenCount: function getChildrenCount() {
|
|
@@ -94,7 +105,7 @@ var useMultiBodiedExtensionActions = function useMultiBodiedExtensionActions(_re
|
|
|
94
105
|
return children ? children.toJSON() : [];
|
|
95
106
|
}
|
|
96
107
|
};
|
|
97
|
-
}, [node, editorView, getPos, updateActiveChild]);
|
|
108
|
+
}, [node, editorView, getPos, updateActiveChild, eventDispatcher]);
|
|
98
109
|
return actions;
|
|
99
110
|
};
|
|
100
111
|
var navigationCSS = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n // make sure the user can't see a range selection inside the navigation\n // This is really important to keep the navigation working properly\n user-select: none;\n -webkit-user-modify: read-only;\n border: 1px solid ", ";\n background-color: ", ";\n"])), "var(--ds-border, ".concat(N40, ")"), "var(--ds-background-inverse-subtle, ".concat(N50, ")"));
|
|
@@ -103,7 +114,8 @@ var MultiBodiedExtension = function MultiBodiedExtension(_ref2) {
|
|
|
103
114
|
handleContentDOMRef = _ref2.handleContentDOMRef,
|
|
104
115
|
getPos = _ref2.getPos,
|
|
105
116
|
tryExtensionHandler = _ref2.tryExtensionHandler,
|
|
106
|
-
editorView = _ref2.editorView
|
|
117
|
+
editorView = _ref2.editorView,
|
|
118
|
+
eventDispatcher = _ref2.eventDispatcher;
|
|
107
119
|
var _useState = useState(0),
|
|
108
120
|
_useState2 = _slicedToArray(_useState, 2),
|
|
109
121
|
activeChildIndex = _useState2[0],
|
|
@@ -121,6 +133,7 @@ var MultiBodiedExtension = function MultiBodiedExtension(_ref2) {
|
|
|
121
133
|
updateActiveChild: updateActiveChild,
|
|
122
134
|
editorView: editorView,
|
|
123
135
|
getPos: getPos,
|
|
136
|
+
eventDispatcher: eventDispatcher,
|
|
124
137
|
node: node
|
|
125
138
|
});
|
|
126
139
|
var extensionHandlerResult = React.useMemo(function () {
|
|
@@ -145,4 +158,21 @@ var MultiBodiedExtension = function MultiBodiedExtension(_ref2) {
|
|
|
145
158
|
ref: articleRef
|
|
146
159
|
}));
|
|
147
160
|
};
|
|
161
|
+
var sendMBEAnalyticsEvent = function sendMBEAnalyticsEvent(action, node, eventDispatcher) {
|
|
162
|
+
var analyticsDispatch = createDispatch(eventDispatcher);
|
|
163
|
+
analyticsDispatch(analyticsEventKey, {
|
|
164
|
+
payload: {
|
|
165
|
+
action: action,
|
|
166
|
+
actionSubject: ACTION_SUBJECT.MULTI_BODIED_EXTENSION,
|
|
167
|
+
eventType: EVENT_TYPE.TRACK,
|
|
168
|
+
attributes: {
|
|
169
|
+
extensionType: node.attrs.extensionType,
|
|
170
|
+
extensionKey: node.attrs.extensionKey,
|
|
171
|
+
localId: node.attrs.localId,
|
|
172
|
+
maxFramesCount: node.attrs.maxFrames,
|
|
173
|
+
currentFramesCount: node.content.childCount
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
};
|
|
148
178
|
export default MultiBodiedExtension;
|
|
@@ -28,7 +28,8 @@ var Extension = /*#__PURE__*/function (_Component) {
|
|
|
28
28
|
extensionHandlers = _this$props.extensionHandlers,
|
|
29
29
|
references = _this$props.references,
|
|
30
30
|
editorAppearance = _this$props.editorAppearance,
|
|
31
|
-
pluginInjectionApi = _this$props.pluginInjectionApi
|
|
31
|
+
pluginInjectionApi = _this$props.pluginInjectionApi,
|
|
32
|
+
eventDispatcher = _this$props.eventDispatcher;
|
|
32
33
|
return /*#__PURE__*/React.createElement(ExtensionComponent, {
|
|
33
34
|
editorView: editorView,
|
|
34
35
|
node: node,
|
|
@@ -38,7 +39,8 @@ var Extension = /*#__PURE__*/function (_Component) {
|
|
|
38
39
|
handleContentDOMRef: handleContentDOMRef,
|
|
39
40
|
extensionHandlers: extensionHandlers,
|
|
40
41
|
editorAppearance: editorAppearance,
|
|
41
|
-
pluginInjectionApi: pluginInjectionApi
|
|
42
|
+
pluginInjectionApi: pluginInjectionApi,
|
|
43
|
+
eventDispatcher: eventDispatcher
|
|
42
44
|
});
|
|
43
45
|
});
|
|
44
46
|
_this.providerFactory = props.providerFactory || new ProviderFactory();
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export var name = "@atlaskit/editor-core";
|
|
2
|
-
export var version = "189.6.
|
|
2
|
+
export var version = "189.6.24";
|
|
@@ -6,6 +6,7 @@ import type { ExtensionHandlers, ExtensionProvider, ReferenceEntity } from '@atl
|
|
|
6
6
|
import type { ProsemirrorGetPosHandler } from '@atlaskit/editor-common/react-node-view';
|
|
7
7
|
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
8
8
|
import type { PluginInjectionAPIWithDependency, EditorAppearance } from '@atlaskit/editor-common/types';
|
|
9
|
+
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
9
10
|
export interface Props {
|
|
10
11
|
editorView: EditorView;
|
|
11
12
|
node: PMNode;
|
|
@@ -16,6 +17,7 @@ export interface Props {
|
|
|
16
17
|
references?: ReferenceEntity[];
|
|
17
18
|
editorAppearance?: EditorAppearance;
|
|
18
19
|
pluginInjectionApi: PluginInjectionAPIWithDependency<WidthPlugin> | undefined;
|
|
20
|
+
eventDispatcher?: EventDispatcher;
|
|
19
21
|
}
|
|
20
22
|
export interface State {
|
|
21
23
|
extensionProvider?: ExtensionProvider;
|
|
@@ -4,6 +4,7 @@ import React from 'react';
|
|
|
4
4
|
import type { MultiBodiedExtensionActions } from '@atlaskit/editor-common/extensions';
|
|
5
5
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
6
6
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
7
|
+
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
7
8
|
export type TryExtensionHandlerType = (actions: MultiBodiedExtensionActions | undefined) => React.ReactElement | null;
|
|
8
9
|
type Props = {
|
|
9
10
|
node: PmNode;
|
|
@@ -11,6 +12,7 @@ type Props = {
|
|
|
11
12
|
editorView: EditorView;
|
|
12
13
|
getPos: () => number | undefined;
|
|
13
14
|
tryExtensionHandler: TryExtensionHandlerType;
|
|
15
|
+
eventDispatcher?: EventDispatcher;
|
|
14
16
|
};
|
|
15
|
-
declare const MultiBodiedExtension: ({ node, handleContentDOMRef, getPos, tryExtensionHandler, editorView, }: Props) => jsx.JSX.Element;
|
|
17
|
+
declare const MultiBodiedExtension: ({ node, handleContentDOMRef, getPos, tryExtensionHandler, editorView, eventDispatcher, }: Props) => jsx.JSX.Element;
|
|
16
18
|
export default MultiBodiedExtension;
|
|
@@ -6,6 +6,7 @@ import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
|
6
6
|
import type { ProsemirrorGetPosHandler } from '@atlaskit/editor-common/react-node-view';
|
|
7
7
|
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
8
8
|
import type { PluginInjectionAPIWithDependency, EditorAppearance } from '@atlaskit/editor-common/types';
|
|
9
|
+
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
9
10
|
export interface Props {
|
|
10
11
|
editorView: EditorView;
|
|
11
12
|
node: PMNode;
|
|
@@ -16,6 +17,7 @@ export interface Props {
|
|
|
16
17
|
references?: ReferenceEntity[];
|
|
17
18
|
editorAppearance?: EditorAppearance;
|
|
18
19
|
pluginInjectionApi: PluginInjectionAPIWithDependency<WidthPlugin> | undefined;
|
|
20
|
+
eventDispatcher?: EventDispatcher;
|
|
19
21
|
}
|
|
20
22
|
export default class Extension extends Component<Props, any> {
|
|
21
23
|
static displayName: string;
|
|
@@ -6,6 +6,7 @@ import type { ExtensionHandlers, ExtensionProvider, ReferenceEntity } from '@atl
|
|
|
6
6
|
import type { ProsemirrorGetPosHandler } from '@atlaskit/editor-common/react-node-view';
|
|
7
7
|
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
8
8
|
import type { PluginInjectionAPIWithDependency, EditorAppearance } from '@atlaskit/editor-common/types';
|
|
9
|
+
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
9
10
|
export interface Props {
|
|
10
11
|
editorView: EditorView;
|
|
11
12
|
node: PMNode;
|
|
@@ -16,6 +17,7 @@ export interface Props {
|
|
|
16
17
|
references?: ReferenceEntity[];
|
|
17
18
|
editorAppearance?: EditorAppearance;
|
|
18
19
|
pluginInjectionApi: PluginInjectionAPIWithDependency<WidthPlugin> | undefined;
|
|
20
|
+
eventDispatcher?: EventDispatcher;
|
|
19
21
|
}
|
|
20
22
|
export interface State {
|
|
21
23
|
extensionProvider?: ExtensionProvider;
|
|
@@ -4,6 +4,7 @@ import React from 'react';
|
|
|
4
4
|
import type { MultiBodiedExtensionActions } from '@atlaskit/editor-common/extensions';
|
|
5
5
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
6
6
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
7
|
+
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
7
8
|
export type TryExtensionHandlerType = (actions: MultiBodiedExtensionActions | undefined) => React.ReactElement | null;
|
|
8
9
|
type Props = {
|
|
9
10
|
node: PmNode;
|
|
@@ -11,6 +12,7 @@ type Props = {
|
|
|
11
12
|
editorView: EditorView;
|
|
12
13
|
getPos: () => number | undefined;
|
|
13
14
|
tryExtensionHandler: TryExtensionHandlerType;
|
|
15
|
+
eventDispatcher?: EventDispatcher;
|
|
14
16
|
};
|
|
15
|
-
declare const MultiBodiedExtension: ({ node, handleContentDOMRef, getPos, tryExtensionHandler, editorView, }: Props) => jsx.JSX.Element;
|
|
17
|
+
declare const MultiBodiedExtension: ({ node, handleContentDOMRef, getPos, tryExtensionHandler, editorView, eventDispatcher, }: Props) => jsx.JSX.Element;
|
|
16
18
|
export default MultiBodiedExtension;
|
|
@@ -6,6 +6,7 @@ import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
|
6
6
|
import type { ProsemirrorGetPosHandler } from '@atlaskit/editor-common/react-node-view';
|
|
7
7
|
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
8
8
|
import type { PluginInjectionAPIWithDependency, EditorAppearance } from '@atlaskit/editor-common/types';
|
|
9
|
+
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
9
10
|
export interface Props {
|
|
10
11
|
editorView: EditorView;
|
|
11
12
|
node: PMNode;
|
|
@@ -16,6 +17,7 @@ export interface Props {
|
|
|
16
17
|
references?: ReferenceEntity[];
|
|
17
18
|
editorAppearance?: EditorAppearance;
|
|
18
19
|
pluginInjectionApi: PluginInjectionAPIWithDependency<WidthPlugin> | undefined;
|
|
20
|
+
eventDispatcher?: EventDispatcher;
|
|
19
21
|
}
|
|
20
22
|
export default class Extension extends Component<Props, any> {
|
|
21
23
|
static displayName: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "189.6.
|
|
3
|
+
"version": "189.6.24",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -192,7 +192,7 @@
|
|
|
192
192
|
"@atlaskit/webdriver-runner": "*",
|
|
193
193
|
"@atlassian/adf-schema-json": "^1.0.7",
|
|
194
194
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
195
|
-
"@atlassian/editor-extension-link-create": "^1.
|
|
195
|
+
"@atlassian/editor-extension-link-create": "^1.1.0",
|
|
196
196
|
"@atlassian/feature-flags-test-utils": "^0.1.1",
|
|
197
197
|
"@atlassian/link-picker-plugins": "^24.0.0",
|
|
198
198
|
"@atlassian/search-provider": "2.4.11",
|