@atlaskit/editor-core 187.19.0 → 187.19.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 +7 -0
- package/dist/cjs/plugins/media/index.js +4 -3
- package/dist/cjs/plugins/media/pm-plugins/alt-text/commands.js +10 -7
- package/dist/cjs/plugins/media/pm-plugins/alt-text/keymap.js +2 -2
- package/dist/cjs/plugins/media/pm-plugins/main.js +9 -9
- package/dist/cjs/plugins/media/toolbar/alt-text.js +2 -2
- package/dist/cjs/plugins/media/toolbar/index.js +12 -11
- package/dist/cjs/plugins/media/utils/media-single.js +13 -13
- package/dist/cjs/plugins/paste/handlers.js +2 -2
- package/dist/cjs/plugins/paste/pm-plugins/analytics.js +2 -2
- package/dist/cjs/plugins/paste/pm-plugins/main.js +4 -4
- package/dist/cjs/plugins/selection/gap-cursor/styles.js +1 -1
- package/dist/cjs/plugins/selection/gap-cursor/utils/place-gap-cursor.js +3 -3
- package/dist/cjs/plugins/selection/gap-cursor/utils.js +6 -3
- package/dist/cjs/plugins/selection/pm-plugins/gap-cursor-main.js +3 -3
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/plugins/media/index.js +6 -3
- package/dist/es2019/plugins/media/pm-plugins/alt-text/commands.js +3 -2
- package/dist/es2019/plugins/media/pm-plugins/alt-text/keymap.js +2 -2
- package/dist/es2019/plugins/media/pm-plugins/main.js +7 -7
- package/dist/es2019/plugins/media/toolbar/alt-text.js +2 -2
- package/dist/es2019/plugins/media/toolbar/index.js +12 -11
- package/dist/es2019/plugins/media/utils/media-single.js +7 -8
- package/dist/es2019/plugins/paste/handlers.js +2 -3
- package/dist/es2019/plugins/paste/pm-plugins/analytics.js +2 -2
- package/dist/es2019/plugins/paste/pm-plugins/main.js +4 -4
- package/dist/es2019/plugins/selection/gap-cursor/styles.js +2 -1
- package/dist/es2019/plugins/selection/gap-cursor/utils/place-gap-cursor.js +4 -4
- package/dist/es2019/plugins/selection/gap-cursor/utils.js +5 -2
- package/dist/es2019/plugins/selection/pm-plugins/gap-cursor-main.js +4 -4
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/plugins/media/index.js +4 -3
- package/dist/esm/plugins/media/pm-plugins/alt-text/commands.js +10 -7
- package/dist/esm/plugins/media/pm-plugins/alt-text/keymap.js +2 -2
- package/dist/esm/plugins/media/pm-plugins/main.js +7 -7
- package/dist/esm/plugins/media/toolbar/alt-text.js +2 -2
- package/dist/esm/plugins/media/toolbar/index.js +12 -11
- package/dist/esm/plugins/media/utils/media-single.js +7 -7
- package/dist/esm/plugins/paste/handlers.js +2 -3
- package/dist/esm/plugins/paste/pm-plugins/analytics.js +2 -2
- package/dist/esm/plugins/paste/pm-plugins/main.js +4 -4
- package/dist/esm/plugins/selection/gap-cursor/styles.js +1 -1
- package/dist/esm/plugins/selection/gap-cursor/utils/place-gap-cursor.js +4 -4
- package/dist/esm/plugins/selection/gap-cursor/utils.js +5 -2
- package/dist/esm/plugins/selection/pm-plugins/gap-cursor-main.js +4 -4
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/plugins/media/pm-plugins/alt-text/commands.d.ts +2 -1
- package/dist/types/plugins/media/pm-plugins/alt-text/keymap.d.ts +2 -1
- package/dist/types/plugins/media/toolbar/alt-text.d.ts +2 -1
- package/dist/types/plugins/media/utils/media-single.d.ts +3 -3
- package/dist/types/plugins/paste/handlers.d.ts +2 -1
- package/dist/types/plugins/paste/index.d.ts +3 -1
- package/dist/types/plugins/paste/pm-plugins/analytics.d.ts +2 -1
- package/dist/types/plugins/selection/gap-cursor/utils.d.ts +1 -1
- package/dist/types-ts4.5/plugins/media/pm-plugins/alt-text/commands.d.ts +2 -1
- package/dist/types-ts4.5/plugins/media/pm-plugins/alt-text/keymap.d.ts +2 -1
- package/dist/types-ts4.5/plugins/media/toolbar/alt-text.d.ts +2 -1
- package/dist/types-ts4.5/plugins/media/utils/media-single.d.ts +3 -3
- package/dist/types-ts4.5/plugins/paste/handlers.d.ts +2 -1
- package/dist/types-ts4.5/plugins/paste/index.d.ts +3 -1
- package/dist/types-ts4.5/plugins/paste/pm-plugins/analytics.d.ts +2 -1
- package/dist/types-ts4.5/plugins/selection/gap-cursor/utils.d.ts +1 -1
- package/package.json +1 -1
- package/report.api.md +1 -0
- package/tmp/api-report-tmp.d.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 187.19.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`f284dd4d761`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f284dd4d761) - updated withAnalytics usage to new EditorAnalyticsAPI
|
|
8
|
+
- [`442d9be406d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/442d9be406d) - [ux] [ED-19027] Fixed gap cursor for nodes with fixed width
|
|
9
|
+
|
|
3
10
|
## 187.19.0
|
|
4
11
|
|
|
5
12
|
### Minor Changes
|
|
@@ -145,8 +145,9 @@ var mediaPlugin = function mediaPlugin() {
|
|
|
145
145
|
pmPlugins.push({
|
|
146
146
|
name: 'mediaAltTextKeymap',
|
|
147
147
|
plugin: function plugin(_ref4) {
|
|
148
|
+
var _api$dependencies$ana2;
|
|
148
149
|
var schema = _ref4.schema;
|
|
149
|
-
return (0, _keymap.default)(schema);
|
|
150
|
+
return (0, _keymap.default)(schema, api === null || api === void 0 ? void 0 : (_api$dependencies$ana2 = api.dependencies.analytics) === null || _api$dependencies$ana2 === void 0 ? void 0 : _api$dependencies$ana2.actions);
|
|
150
151
|
}
|
|
151
152
|
});
|
|
152
153
|
}
|
|
@@ -241,11 +242,11 @@ var mediaPlugin = function mediaPlugin() {
|
|
|
241
242
|
return /*#__PURE__*/_react.default.createElement(_quickInsert.IconImages, null);
|
|
242
243
|
},
|
|
243
244
|
action: function action(insert, state) {
|
|
244
|
-
var _api$dependencies$
|
|
245
|
+
var _api$dependencies$ana3;
|
|
245
246
|
var pluginState = _main.stateKey.getState(state);
|
|
246
247
|
pluginState === null || pluginState === void 0 ? void 0 : pluginState.showMediaPicker();
|
|
247
248
|
var tr = insert('');
|
|
248
|
-
api === null || api === void 0 ? void 0 : (_api$dependencies$
|
|
249
|
+
api === null || api === void 0 ? void 0 : (_api$dependencies$ana3 = api.dependencies.analytics) === null || _api$dependencies$ana3 === void 0 ? void 0 : _api$dependencies$ana3.actions.attachAnalyticsEvent({
|
|
249
250
|
action: _analytics.ACTION.OPENED,
|
|
250
251
|
actionSubject: _analytics.ACTION_SUBJECT.PICKER,
|
|
251
252
|
actionSubjectId: _analytics.ACTION_SUBJECT_ID.PICKER_CLOUD,
|
|
@@ -8,16 +8,19 @@ exports.updateAltText = exports.openMediaAltTextMenu = exports.closeMediaAltText
|
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _ = require(".");
|
|
10
10
|
var _mediaCommon = require("../../utils/media-common");
|
|
11
|
-
var _analytics = require("
|
|
11
|
+
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
12
|
+
var _editorAnalytics = require("@atlaskit/editor-common/editor-analytics");
|
|
12
13
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
13
14
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
14
15
|
var createCommandWithAnalytics = function createCommandWithAnalytics(actionType, action, transform) {
|
|
15
|
-
return (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
return function (editorAnalyticsAPI) {
|
|
17
|
+
return (0, _editorAnalytics.withAnalytics)(editorAnalyticsAPI, {
|
|
18
|
+
action: actionType,
|
|
19
|
+
actionSubject: _analytics.ACTION_SUBJECT.MEDIA,
|
|
20
|
+
actionSubjectId: _analytics.ACTION_SUBJECT_ID.ALT_TEXT,
|
|
21
|
+
eventType: _analytics.EVENT_TYPE.TRACK
|
|
22
|
+
})((0, _.createCommand)(action, transform));
|
|
23
|
+
};
|
|
21
24
|
};
|
|
22
25
|
var closeMediaAltTextMenu = (0, _.createCommand)(function (state) {
|
|
23
26
|
if ((0, _mediaCommon.isSelectionMediaSingleNode)(state)) {
|
|
@@ -10,9 +10,9 @@ var keymaps = _interopRequireWildcard(require("../../../../keymaps"));
|
|
|
10
10
|
var _commands = require("./commands");
|
|
11
11
|
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); }
|
|
12
12
|
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; }
|
|
13
|
-
function keymapPlugin(schema) {
|
|
13
|
+
function keymapPlugin(schema, editorAnalyticsAPI) {
|
|
14
14
|
var list = {};
|
|
15
|
-
keymaps.bindKeymapWithCommand(keymaps.addAltText.common, _commands.openMediaAltTextMenu, list);
|
|
15
|
+
keymaps.bindKeymapWithCommand(keymaps.addAltText.common, (0, _commands.openMediaAltTextMenu)(editorAnalyticsAPI), list);
|
|
16
16
|
keymaps.bindKeymapWithCommand(keymaps.escape.common, _commands.closeMediaAltTextMenu, list);
|
|
17
17
|
return (0, _keymap.keymap)(list);
|
|
18
18
|
}
|
|
@@ -33,7 +33,7 @@ var _mediaCommon = require("../utils/media-common");
|
|
|
33
33
|
var helpers = _interopRequireWildcard(require("../commands/helpers"));
|
|
34
34
|
var _pluginKey = require("./plugin-key");
|
|
35
35
|
var _pickerFacade = _interopRequireDefault(require("../picker-facade"));
|
|
36
|
-
var
|
|
36
|
+
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
37
37
|
var _document = require("../../../utils/document");
|
|
38
38
|
var _mediaCommon2 = require("@atlaskit/media-common");
|
|
39
39
|
var _utils3 = require("../../../utils");
|
|
@@ -240,16 +240,16 @@ var MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
|
240
240
|
});
|
|
241
241
|
}
|
|
242
242
|
if ((0, _mediaSingle.isMediaSingle)(state.schema, mediaStateWithContext.fileMimeType)) {
|
|
243
|
-
var _this$pluginInjection;
|
|
243
|
+
var _this$pluginInjection, _pluginInjectionApi$d, _pluginInjectionApi$d2;
|
|
244
244
|
// read width state right before inserting to get up-to-date and define values
|
|
245
245
|
var widthPluginState = (_this$pluginInjection = _this.pluginInjectionApi) === null || _this$pluginInjection === void 0 ? void 0 : _this$pluginInjection.dependencies.width.sharedState.currentState();
|
|
246
|
-
(0, _mediaSingle.insertMediaSingleNode)(_this.view, mediaStateWithContext, _this.getInputMethod(pickerType), collection, _this.mediaOptions && _this.mediaOptions.alignLeftOnInsert, _this.newInsertionBehaviour, widthPluginState);
|
|
246
|
+
(0, _mediaSingle.insertMediaSingleNode)(_this.view, mediaStateWithContext, _this.getInputMethod(pickerType), collection, _this.mediaOptions && _this.mediaOptions.alignLeftOnInsert, _this.newInsertionBehaviour, widthPluginState, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d === void 0 ? void 0 : (_pluginInjectionApi$d2 = _pluginInjectionApi$d.analytics) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.actions);
|
|
247
247
|
} else if ((0, _mediaCommon2.getMediaFeatureFlag)('mediaInline', (_this$mediaOptions2 = _this.mediaOptions) === null || _this$mediaOptions2 === void 0 ? void 0 : _this$mediaOptions2.featureFlags) && !(0, _document.isInEmptyLine)(state) && (!(0, _mediaCommon.isInsidePotentialEmptyParagraph)(state) || (0, _utils3.isInListItem)(state)) && (0, _mediaFiles.canInsertMediaInline)(state)) {
|
|
248
|
-
var _pluginInjectionApi$d, _pluginInjectionApi$d2;
|
|
249
|
-
(0, _mediaFiles.insertMediaInlineNode)(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d === void 0 ? void 0 : (_pluginInjectionApi$d2 = _pluginInjectionApi$d.analytics) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.actions)(_this.view, mediaStateWithContext, collection, _this.getInputMethod(pickerType));
|
|
250
|
-
} else {
|
|
251
248
|
var _pluginInjectionApi$d3, _pluginInjectionApi$d4;
|
|
252
|
-
(0, _mediaFiles.
|
|
249
|
+
(0, _mediaFiles.insertMediaInlineNode)(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d3 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d3 === void 0 ? void 0 : (_pluginInjectionApi$d4 = _pluginInjectionApi$d3.analytics) === null || _pluginInjectionApi$d4 === void 0 ? void 0 : _pluginInjectionApi$d4.actions)(_this.view, mediaStateWithContext, collection, _this.getInputMethod(pickerType));
|
|
250
|
+
} else {
|
|
251
|
+
var _pluginInjectionApi$d5, _pluginInjectionApi$d6;
|
|
252
|
+
(0, _mediaFiles.insertMediaGroupNode)(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d5 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d5 === void 0 ? void 0 : (_pluginInjectionApi$d6 = _pluginInjectionApi$d5.analytics) === null || _pluginInjectionApi$d6 === void 0 ? void 0 : _pluginInjectionApi$d6.actions)(_this.view, [mediaStateWithContext], collection, _this.getInputMethod(pickerType));
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
// do events when media state changes
|
|
@@ -409,9 +409,9 @@ var MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
|
409
409
|
(0, _defineProperty2.default)(this, "getInputMethod", function (pickerType) {
|
|
410
410
|
switch (pickerType) {
|
|
411
411
|
case 'clipboard':
|
|
412
|
-
return
|
|
412
|
+
return _analytics.INPUT_METHOD.CLIPBOARD;
|
|
413
413
|
case 'dropzone':
|
|
414
|
-
return
|
|
414
|
+
return _analytics.INPUT_METHOD.DRAG_AND_DROP;
|
|
415
415
|
}
|
|
416
416
|
return;
|
|
417
417
|
});
|
|
@@ -19,7 +19,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
19
19
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
20
20
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
21
21
|
var testId = 'alt-text-edit-button';
|
|
22
|
-
var altTextButton = function altTextButton(intl, state) {
|
|
22
|
+
var altTextButton = function altTextButton(intl, state, editorAnalyticsAPI) {
|
|
23
23
|
var mediaNode = (0, _mediaCommon.getMediaNodeFromSelection)(state);
|
|
24
24
|
var message = mediaNode && mediaNode.attrs.alt ? _messages.messages.editAltText : _messages.messages.altText;
|
|
25
25
|
var title = intl.formatMessage(message);
|
|
@@ -27,7 +27,7 @@ var altTextButton = function altTextButton(intl, state) {
|
|
|
27
27
|
title: title,
|
|
28
28
|
id: 'editor.media.altText',
|
|
29
29
|
type: 'button',
|
|
30
|
-
onClick: _commands.openMediaAltTextMenu,
|
|
30
|
+
onClick: (0, _commands.openMediaAltTextMenu)(editorAnalyticsAPI),
|
|
31
31
|
showTitle: true,
|
|
32
32
|
testId: testId,
|
|
33
33
|
tooltipContent: /*#__PURE__*/_react.default.createElement(_keymaps.ToolTipContent, {
|
|
@@ -198,7 +198,7 @@ var generateMediaInlineFloatingToolbar = function generateMediaInlineFloatingToo
|
|
|
198
198
|
return items;
|
|
199
199
|
};
|
|
200
200
|
var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToolbar(state, intl, options, pluginState, mediaLinkingState, pluginInjectionApi, getEditorFeatureFlags) {
|
|
201
|
-
var _pluginInjectionApi$
|
|
201
|
+
var _pluginInjectionApi$d8;
|
|
202
202
|
var mediaSingle = state.schema.nodes.mediaSingle;
|
|
203
203
|
var allowResizing = options.allowResizing,
|
|
204
204
|
allowLinking = options.allowLinking,
|
|
@@ -354,11 +354,12 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
354
354
|
}
|
|
355
355
|
}
|
|
356
356
|
if (allowAltTextOnImages) {
|
|
357
|
-
|
|
357
|
+
var _pluginInjectionApi$d7;
|
|
358
|
+
toolbarButtons.push((0, _altText2.altTextButton)(intl, state, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d7 = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d7 === void 0 ? void 0 : _pluginInjectionApi$d7.actions), {
|
|
358
359
|
type: 'separator'
|
|
359
360
|
});
|
|
360
361
|
}
|
|
361
|
-
var _ref2 = (_pluginInjectionApi$
|
|
362
|
+
var _ref2 = (_pluginInjectionApi$d8 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.decorations.actions) !== null && _pluginInjectionApi$d8 !== void 0 ? _pluginInjectionApi$d8 : {},
|
|
362
363
|
hoverDecoration = _ref2.hoverDecoration;
|
|
363
364
|
var removeButton = {
|
|
364
365
|
id: 'editor.media.delete',
|
|
@@ -387,7 +388,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
387
388
|
return items;
|
|
388
389
|
};
|
|
389
390
|
var floatingToolbar = function floatingToolbar(state, intl) {
|
|
390
|
-
var _pluginInjectionApi$
|
|
391
|
+
var _pluginInjectionApi$d9;
|
|
391
392
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
392
393
|
var pluginInjectionApi = arguments.length > 3 ? arguments[3] : undefined;
|
|
393
394
|
var _state$schema$nodes = state.schema.nodes,
|
|
@@ -403,7 +404,7 @@ var floatingToolbar = function floatingToolbar(state, intl) {
|
|
|
403
404
|
getEditorFeatureFlags = options.getEditorFeatureFlags;
|
|
404
405
|
var mediaPluginState = _pluginKey.stateKey.getState(state);
|
|
405
406
|
var mediaLinkingState = (0, _linking2.getMediaLinkingState)(state);
|
|
406
|
-
var _ref3 = (_pluginInjectionApi$
|
|
407
|
+
var _ref3 = (_pluginInjectionApi$d9 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.decorations.actions) !== null && _pluginInjectionApi$d9 !== void 0 ? _pluginInjectionApi$d9 : {},
|
|
407
408
|
hoverDecoration = _ref3.hoverDecoration;
|
|
408
409
|
if (!mediaPluginState || mediaPluginState.isResizing) {
|
|
409
410
|
return;
|
|
@@ -425,10 +426,10 @@ var floatingToolbar = function floatingToolbar(state, intl) {
|
|
|
425
426
|
if (allowAltTextOnImages) {
|
|
426
427
|
var mediaAltTextPluginState = (0, _altText.getPluginState)(state);
|
|
427
428
|
if (mediaAltTextPluginState.isAltTextEditorOpen) {
|
|
428
|
-
var _pluginInjectionApi$
|
|
429
|
+
var _pluginInjectionApi$d10;
|
|
429
430
|
return (0, _altText2.getAltTextToolbar)(baseToolbar, {
|
|
430
431
|
altTextValidator: altTextValidator,
|
|
431
|
-
forceFocusSelector: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
432
|
+
forceFocusSelector: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d10 = pluginInjectionApi.dependencies.floatingToolbar.actions) === null || _pluginInjectionApi$d10 === void 0 ? void 0 : _pluginInjectionApi$d10.forceFocusSelector
|
|
432
433
|
});
|
|
433
434
|
}
|
|
434
435
|
}
|
|
@@ -439,22 +440,22 @@ var floatingToolbar = function floatingToolbar(state, intl) {
|
|
|
439
440
|
selectedNodeType = state.selection.node.type;
|
|
440
441
|
}
|
|
441
442
|
if (allowMediaInline && (parentMediaGroupNode === null || parentMediaGroupNode === void 0 ? void 0 : parentMediaGroupNode.node.type) === mediaGroup) {
|
|
442
|
-
var _pluginInjectionApi$
|
|
443
|
+
var _pluginInjectionApi$d11, _pluginInjectionApi$d12;
|
|
443
444
|
var mediaOffset = state.selection.$from.parentOffset + 1;
|
|
444
445
|
baseToolbar.getDomRef = function () {
|
|
445
446
|
var _mediaPluginState$ele;
|
|
446
447
|
var selector = (0, _mediaFilmstrip.mediaFilmstripItemDOMSelector)(mediaOffset);
|
|
447
448
|
return (_mediaPluginState$ele = mediaPluginState.element) === null || _mediaPluginState$ele === void 0 ? void 0 : _mediaPluginState$ele.querySelector(selector);
|
|
448
449
|
};
|
|
449
|
-
items = generateMediaCardFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
450
|
+
items = generateMediaCardFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d11 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d11 === void 0 ? void 0 : (_pluginInjectionApi$d12 = _pluginInjectionApi$d11.analytics) === null || _pluginInjectionApi$d12 === void 0 ? void 0 : _pluginInjectionApi$d12.actions);
|
|
450
451
|
} else if (allowMediaInline && selectedNodeType && selectedNodeType === mediaInline) {
|
|
451
|
-
var _pluginInjectionApi$
|
|
452
|
+
var _pluginInjectionApi$d13, _pluginInjectionApi$d14;
|
|
452
453
|
baseToolbar.getDomRef = function () {
|
|
453
454
|
var _mediaPluginState$ele2;
|
|
454
455
|
var element = (_mediaPluginState$ele2 = mediaPluginState.element) === null || _mediaPluginState$ele2 === void 0 ? void 0 : _mediaPluginState$ele2.querySelector(".".concat(_styles.MediaInlineNodeSelector));
|
|
455
456
|
return element || mediaPluginState.element;
|
|
456
457
|
};
|
|
457
|
-
items = generateMediaInlineFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
458
|
+
items = generateMediaInlineFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d13 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d13 === void 0 ? void 0 : (_pluginInjectionApi$d14 = _pluginInjectionApi$d13.analytics) === null || _pluginInjectionApi$d14 === void 0 ? void 0 : _pluginInjectionApi$d14.actions);
|
|
458
459
|
} else {
|
|
459
460
|
baseToolbar.getDomRef = function () {
|
|
460
461
|
var _mediaPluginState$ele3;
|
|
@@ -16,8 +16,7 @@ var _utils3 = require("@atlaskit/editor-common/utils");
|
|
|
16
16
|
var _mediaSingle = require("@atlaskit/editor-common/media-single");
|
|
17
17
|
var _mediaCommon = require("../utils/media-common");
|
|
18
18
|
var _slice = require("../../../utils/slice");
|
|
19
|
-
var _analytics = require("
|
|
20
|
-
var _analytics2 = require("@atlaskit/editor-common/analytics");
|
|
19
|
+
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
21
20
|
var _insert = require("@atlaskit/editor-common/insert");
|
|
22
21
|
var _isImage = require("./is-image");
|
|
23
22
|
var _position = require("../../../utils/prosemirror/position");
|
|
@@ -27,15 +26,15 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
27
26
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
28
27
|
var getInsertMediaAnalytics = function getInsertMediaAnalytics(inputMethod, fileExtension) {
|
|
29
28
|
return {
|
|
30
|
-
action:
|
|
31
|
-
actionSubject:
|
|
32
|
-
actionSubjectId:
|
|
29
|
+
action: _analytics.ACTION.INSERTED,
|
|
30
|
+
actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
|
|
31
|
+
actionSubjectId: _analytics.ACTION_SUBJECT_ID.MEDIA,
|
|
33
32
|
attributes: {
|
|
34
33
|
inputMethod: inputMethod,
|
|
35
34
|
fileExtension: fileExtension,
|
|
36
|
-
type:
|
|
35
|
+
type: _analytics.ACTION_SUBJECT_ID.MEDIA_SINGLE
|
|
37
36
|
},
|
|
38
|
-
eventType:
|
|
37
|
+
eventType: _analytics.EVENT_TYPE.TRACK
|
|
39
38
|
};
|
|
40
39
|
};
|
|
41
40
|
function shouldAddParagraph(state) {
|
|
@@ -43,6 +42,7 @@ function shouldAddParagraph(state) {
|
|
|
43
42
|
}
|
|
44
43
|
function insertNodesWithOptionalParagraph(nodes) {
|
|
45
44
|
var analyticsAttributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
45
|
+
var editorAnalyticsAPI = arguments.length > 2 ? arguments[2] : undefined;
|
|
46
46
|
return function (state, dispatch) {
|
|
47
47
|
var tr = state.tr,
|
|
48
48
|
schema = state.schema;
|
|
@@ -56,7 +56,7 @@ function insertNodesWithOptionalParagraph(nodes) {
|
|
|
56
56
|
}
|
|
57
57
|
tr.replaceSelection(new _model.Slice(_model.Fragment.from(nodes), 0, openEnd));
|
|
58
58
|
if (inputMethod) {
|
|
59
|
-
|
|
59
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaAnalytics(inputMethod, fileExtension))(tr);
|
|
60
60
|
}
|
|
61
61
|
if (dispatch) {
|
|
62
62
|
dispatch(tr);
|
|
@@ -68,7 +68,7 @@ var isMediaSingle = function isMediaSingle(schema, fileMimeType) {
|
|
|
68
68
|
return !!schema.nodes.mediaSingle && (0, _isImage.isImage)(fileMimeType);
|
|
69
69
|
};
|
|
70
70
|
exports.isMediaSingle = isMediaSingle;
|
|
71
|
-
var insertMediaAsMediaSingle = function insertMediaAsMediaSingle(view, node, inputMethod) {
|
|
71
|
+
var insertMediaAsMediaSingle = function insertMediaAsMediaSingle(view, node, inputMethod, editorAnalyticsAPI) {
|
|
72
72
|
var state = view.state,
|
|
73
73
|
dispatch = view.dispatch;
|
|
74
74
|
var _state$schema$nodes = state.schema.nodes,
|
|
@@ -88,10 +88,10 @@ var insertMediaAsMediaSingle = function insertMediaAsMediaSingle(view, node, inp
|
|
|
88
88
|
inputMethod: inputMethod,
|
|
89
89
|
fileExtension: node.attrs.__fileMimeType
|
|
90
90
|
};
|
|
91
|
-
return insertNodesWithOptionalParagraph(nodes, analyticsAttributes)(state, dispatch);
|
|
91
|
+
return insertNodesWithOptionalParagraph(nodes, analyticsAttributes, editorAnalyticsAPI)(state, dispatch);
|
|
92
92
|
};
|
|
93
93
|
exports.insertMediaAsMediaSingle = insertMediaAsMediaSingle;
|
|
94
|
-
var insertMediaSingleNode = function insertMediaSingleNode(view, mediaState, inputMethod, collection, alignLeftOnInsert, newInsertionBehaviour, widthPluginState) {
|
|
94
|
+
var insertMediaSingleNode = function insertMediaSingleNode(view, mediaState, inputMethod, collection, alignLeftOnInsert, newInsertionBehaviour, widthPluginState, editorAnalyticsAPI) {
|
|
95
95
|
var _state$selection$$fro;
|
|
96
96
|
if (collection === undefined) {
|
|
97
97
|
return false;
|
|
@@ -122,7 +122,7 @@ var insertMediaSingleNode = function insertMediaSingleNode(view, mediaState, inp
|
|
|
122
122
|
insertNodesWithOptionalParagraph([node], {
|
|
123
123
|
fileExtension: fileExtension,
|
|
124
124
|
inputMethod: inputMethod
|
|
125
|
-
})(state, dispatch);
|
|
125
|
+
}, editorAnalyticsAPI)(state, dispatch);
|
|
126
126
|
} else {
|
|
127
127
|
var tr = null;
|
|
128
128
|
if (newInsertionBehaviour) {
|
|
@@ -133,7 +133,7 @@ var insertMediaSingleNode = function insertMediaSingleNode(view, mediaState, inp
|
|
|
133
133
|
tr = (0, _utils.safeInsert)(content, undefined, true)(state.tr);
|
|
134
134
|
}
|
|
135
135
|
if (inputMethod) {
|
|
136
|
-
|
|
136
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaAnalytics(inputMethod, fileExtension))(tr);
|
|
137
137
|
}
|
|
138
138
|
dispatch(tr);
|
|
139
139
|
}
|
|
@@ -544,12 +544,12 @@ function isOnlyMediaSingle(state, slice) {
|
|
|
544
544
|
var mediaSingle = state.schema.nodes.mediaSingle;
|
|
545
545
|
return mediaSingle && slice.content.childCount === 1 && slice.content.firstChild.type === mediaSingle;
|
|
546
546
|
}
|
|
547
|
-
function handleMediaSingle(inputMethod) {
|
|
547
|
+
function handleMediaSingle(inputMethod, editorAnalyticsAPI) {
|
|
548
548
|
return function (slice) {
|
|
549
549
|
return function (state, dispatch, view) {
|
|
550
550
|
if (view) {
|
|
551
551
|
if (isOnlyMedia(state, slice)) {
|
|
552
|
-
return (0, _mediaSingle.insertMediaAsMediaSingle)(view, slice.content.firstChild, inputMethod);
|
|
552
|
+
return (0, _mediaSingle.insertMediaAsMediaSingle)(view, slice.content.firstChild, inputMethod, editorAnalyticsAPI);
|
|
553
553
|
}
|
|
554
554
|
if ((0, _utils3.insideTable)(state) && isOnlyMediaSingle(state, slice)) {
|
|
555
555
|
var tr = state.tr.replaceSelection(slice);
|
|
@@ -257,10 +257,10 @@ var handleCodeBlockWithAnalytics = function handleCodeBlockWithAnalytics(view, e
|
|
|
257
257
|
}))((0, _handlers.handleCodeBlock)(text));
|
|
258
258
|
};
|
|
259
259
|
exports.handleCodeBlockWithAnalytics = handleCodeBlockWithAnalytics;
|
|
260
|
-
var handleMediaSingleWithAnalytics = function handleMediaSingleWithAnalytics(view, event, slice, type) {
|
|
260
|
+
var handleMediaSingleWithAnalytics = function handleMediaSingleWithAnalytics(view, event, slice, type, editorAnalyticsAPI) {
|
|
261
261
|
return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
262
262
|
type: type
|
|
263
|
-
}))((0, _handlers.handleMediaSingle)(_analytics.INPUT_METHOD.CLIPBOARD)(slice));
|
|
263
|
+
}))((0, _handlers.handleMediaSingle)(_analytics.INPUT_METHOD.CLIPBOARD, editorAnalyticsAPI)(slice));
|
|
264
264
|
};
|
|
265
265
|
exports.handleMediaSingleWithAnalytics = handleMediaSingleWithAnalytics;
|
|
266
266
|
var handlePastePreservingMarksWithAnalytics = function handlePastePreservingMarksWithAnalytics(view, event, slice, type, pluginInjectionApi) {
|
|
@@ -112,7 +112,7 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
|
|
|
112
112
|
}
|
|
113
113
|
},
|
|
114
114
|
handlePaste: function handlePaste(view, rawEvent, slice) {
|
|
115
|
-
var _text, _analyticsPlugin$perf, _analyticsPlugin$perf2, _schema$nodes, _schema$nodes2, _schema$nodes3;
|
|
115
|
+
var _text, _analyticsPlugin$perf, _analyticsPlugin$perf2, _schema$nodes, _schema$nodes2, _schema$nodes3, _pluginInjectionApi$d4, _pluginInjectionApi$d5;
|
|
116
116
|
var event = rawEvent;
|
|
117
117
|
if (!event.clipboardData) {
|
|
118
118
|
return false;
|
|
@@ -276,7 +276,7 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
|
|
|
276
276
|
if ((0, _analytics.handleCodeBlockWithAnalytics)(view, event, slice, text)(state, dispatch)) {
|
|
277
277
|
return true;
|
|
278
278
|
}
|
|
279
|
-
if ((0, _analytics.handleMediaSingleWithAnalytics)(view, event, slice, isPastedFile ? _analytics2.PasteTypes.binary : _analytics2.PasteTypes.richText)(state, dispatch, view)) {
|
|
279
|
+
if ((0, _analytics.handleMediaSingleWithAnalytics)(view, event, slice, isPastedFile ? _analytics2.PasteTypes.binary : _analytics2.PasteTypes.richText, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d4 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d4 === void 0 ? void 0 : (_pluginInjectionApi$d5 = _pluginInjectionApi$d4.analytics) === null || _pluginInjectionApi$d5 === void 0 ? void 0 : _pluginInjectionApi$d5.actions)(state, dispatch, view)) {
|
|
280
280
|
return true;
|
|
281
281
|
}
|
|
282
282
|
if ((0, _analytics.handleSelectedTableWithAnalytics)(view, event, slice)(state, dispatch)) {
|
|
@@ -309,7 +309,7 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
|
|
|
309
309
|
|
|
310
310
|
// finally, handle rich-text copy-paste
|
|
311
311
|
if (isRichText) {
|
|
312
|
-
var _pluginInjectionApi$
|
|
312
|
+
var _pluginInjectionApi$d6, _pluginInjectionApi$d7;
|
|
313
313
|
// linkify the text where possible
|
|
314
314
|
slice = (0, _utils.linkifyContent)(state.schema)(slice);
|
|
315
315
|
if ((0, _analytics.handlePasteLinkOnSelectedTextWithAnalytics)(view, event, slice, _analytics2.PasteTypes.richText)(state, dispatch)) {
|
|
@@ -317,7 +317,7 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
|
|
|
317
317
|
}
|
|
318
318
|
|
|
319
319
|
// run macro autoconvert prior to other conversions
|
|
320
|
-
if ((0, _handlers.handleMacroAutoConvert)(text, slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
320
|
+
if ((0, _handlers.handleMacroAutoConvert)(text, slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d6 = pluginInjectionApi.dependencies.card) === null || _pluginInjectionApi$d6 === void 0 ? void 0 : (_pluginInjectionApi$d7 = _pluginInjectionApi$d6.actions) === null || _pluginInjectionApi$d7 === void 0 ? void 0 : _pluginInjectionApi$d7.queueCardsFromChangedTr, cardOptions, extensionAutoConverter)(state, dispatch, view)) {
|
|
321
321
|
// TODO: handleMacroAutoConvert dispatch twice, so we can't use the helper
|
|
322
322
|
(0, _analytics.sendPasteAnalyticsEvent)(view, event, slice, {
|
|
323
323
|
type: _analytics2.PasteTypes.richText
|
|
@@ -15,5 +15,5 @@ var gapCursor = '.ProseMirror-gapcursor';
|
|
|
15
15
|
var prosemirrorwidget = '.ProseMirror-widget';
|
|
16
16
|
var wrapLeft = '[layout="wrap-left"]';
|
|
17
17
|
var wrapRight = '[layout="wrap-right"]';
|
|
18
|
-
var gapCursorStyles = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n /* =============== GAP CURSOR ================== */\n .ProseMirror {\n &.", " {\n caret-color: transparent;\n }\n\n ", " {\n display: none;\n pointer-events: none;\n position: relative;\n\n & span {\n caret-color: transparent;\n position: absolute;\n height: 100%;\n width: 100%;\n display: block;\n }\n\n & span::after {\n animation: 1s ", " step-end infinite;\n border-left: 1px solid;\n content: '';\n display: block;\n position: absolute;\n top: 0;\n height: 100%;\n }\n &.-left span::after {\n left: -3px;\n }\n &.-right span::after {\n right: -3px;\n }\n & span[layout='full-width'],\n & span[layout='wide'] {\n margin-left: 50%;\n transform: translateX(-50%);\n }\n &", " {\n float: right;\n }\n\n /* fix vertical alignment of gap cursor */\n &:first-of-type + ul,\n &:first-of-type + span + ul,\n &:first-of-type + ol,\n &:first-of-type + span + ol,\n &:first-of-type + pre,\n &:first-of-type + span + pre,\n &:first-of-type + blockquote,\n &:first-of-type + span + blockquote {\n margin-top: 0;\n }\n }\n &.ProseMirror-focused ", " {\n display: block;\n border-color: transparent;\n }\n }\n\n /* This hack below is for two images aligned side by side */\n ", "", " + span + ", ",\n ", "", " + span + ", ",\n ", " + ", " + ", ",\n ", " + ", " + span + ", ",\n ", " + ", " + ", ",\n ", " + ", " + span + ", ",\n ", " + ", " + ", ",\n ", " + ", " + span ", ",\n ", " + ", " + ", ",\n ", " + ", " + span + ", ",\n ", " + ", " {\n clear: none;\n }\n\n ", " + ", " + ", " > div,\n ", " + ", " + span + ", " > div,\n ", " + ", " + ", " > div,\n ", " + ", " + span + ", " > div,\n ", " + ", " + ", " > div,\n ", " + ", " + span + ", " > div,\n ", " + ", " + ", " > div,\n ", " + ", " + span + ", " > div {\n margin-right: 0;\n margin-left: 0;\n margin-bottom: 0;\n }\n\n ", " + ", ",\n ", " + ", " {\n float: left;\n }\n\n ", " + ", " + span + ", "::after,\n ", " + ", " + span + ", "::after,\n ", " + ", " + ", "::after,\n ", " + ", " + span + ", "::after,\n ", " + ", " + ", "::after,\n ", " + ", " + span + ", "::after {\n visibility: hidden;\n display: block;\n font-size: 0;\n content: ' ';\n clear: both;\n height: 0;\n }\n\n ", " + ", " + ", " + *,\n ", " + ", " + ", " + span + *,\n ", " + ", " + ", " + *,\n ", " + ", " + ", " + span + *,\n ", " + ", " + span + ", " + *,\n ", " + ", " + span + ", " + *,\n ", " + ", " + span + ", " + *,\n ", " + ", " + span + ", " + *,\n ", " + ", " + ", " + * > *,\n ", " + ", " + ", " + span + * > *,\n ", " + ", " + ", " + * > *,\n ", " + ", " + ", " + span + * > *,\n ", " + ", " + span + ", " + * > *,\n ", " + ", " + span + ", " + * > *,\n ", " + ", " + span + ", " + * > *,\n ", " + ", " + span + ", " + * > *,\n ", " + ", " + *,\n ", " + ", " + span + * {\n margin-top: 0;\n }\n"])), hideCaretModifier, gapCursor, gapCursorBlink, wrapRight, gapCursor, gapCursor, wrapLeft, wrapLeft, gapCursor, wrapRight, wrapRight, gapCursor, wrapLeft, wrapRight, gapCursor, wrapLeft, wrapRight, gapCursor, wrapRight, wrapLeft, gapCursor, wrapRight, wrapLeft, wrapLeft, gapCursor, wrapRight, wrapLeft, gapCursor, wrapRight, wrapRight, gapCursor, wrapLeft, wrapRight, gapCursor, wrapLeft, wrapLeft, gapCursor, wrapLeft, gapCursor, wrapRight, wrapLeft, gapCursor, wrapRight, wrapRight, gapCursor, wrapLeft, wrapRight, gapCursor, wrapLeft, gapCursor, wrapRight, wrapLeft, gapCursor, wrapRight, wrapLeft, gapCursor, wrapLeft, wrapRight, gapCursor, wrapLeft, wrapRight, wrapLeft, gapCursor, wrapRight, gapCursor, gapCursor, wrapLeft, wrapRight, gapCursor, wrapRight, wrapLeft, wrapLeft, gapCursor, wrapRight, wrapLeft, gapCursor, wrapRight, wrapRight, gapCursor, wrapLeft, wrapRight, gapCursor, wrapLeft, wrapLeft, gapCursor, wrapRight, wrapLeft, gapCursor, wrapRight, wrapRight, gapCursor, wrapLeft, wrapRight, gapCursor, wrapLeft, wrapLeft, gapCursor, wrapRight, wrapRight, gapCursor, wrapLeft, gapCursor, wrapLeft, wrapRight, gapCursor, wrapRight, wrapLeft, wrapLeft, gapCursor, wrapRight, wrapLeft, gapCursor, wrapRight, wrapRight, gapCursor, wrapLeft, wrapRight, gapCursor, wrapLeft, wrapLeft, gapCursor, wrapRight, wrapRight, gapCursor, wrapLeft, gapCursor, wrapLeft, wrapRight, gapCursor, wrapRight, wrapLeft, prosemirrorwidget, gapCursor, prosemirrorwidget, gapCursor);
|
|
18
|
+
var gapCursorStyles = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n /* =============== GAP CURSOR ================== */\n .ProseMirror {\n &.", " {\n caret-color: transparent;\n }\n\n ", " {\n display: none;\n pointer-events: none;\n position: relative;\n\n & span {\n caret-color: transparent;\n position: absolute;\n height: 100%;\n width: 100%;\n display: block;\n }\n\n & span::after {\n animation: 1s ", " step-end infinite;\n border-left: 1px solid;\n content: '';\n display: block;\n position: absolute;\n top: 0;\n height: 100%;\n }\n &.-left span::after {\n left: -3px;\n }\n &.-right span::after {\n right: -3px;\n }\n & span[layout='full-width'],\n & span[layout='wide'],\n & span[layout='fixed-width'] {\n margin-left: 50%;\n transform: translateX(-50%);\n }\n &", " {\n float: right;\n }\n\n /* fix vertical alignment of gap cursor */\n &:first-of-type + ul,\n &:first-of-type + span + ul,\n &:first-of-type + ol,\n &:first-of-type + span + ol,\n &:first-of-type + pre,\n &:first-of-type + span + pre,\n &:first-of-type + blockquote,\n &:first-of-type + span + blockquote {\n margin-top: 0;\n }\n }\n &.ProseMirror-focused ", " {\n display: block;\n border-color: transparent;\n }\n }\n\n /* This hack below is for two images aligned side by side */\n ", "", " + span + ", ",\n ", "", " + span + ", ",\n ", " + ", " + ", ",\n ", " + ", " + span + ", ",\n ", " + ", " + ", ",\n ", " + ", " + span + ", ",\n ", " + ", " + ", ",\n ", " + ", " + span ", ",\n ", " + ", " + ", ",\n ", " + ", " + span + ", ",\n ", " + ", " {\n clear: none;\n }\n\n ", " + ", " + ", " > div,\n ", " + ", " + span + ", " > div,\n ", " + ", " + ", " > div,\n ", " + ", " + span + ", " > div,\n ", " + ", " + ", " > div,\n ", " + ", " + span + ", " > div,\n ", " + ", " + ", " > div,\n ", " + ", " + span + ", " > div {\n margin-right: 0;\n margin-left: 0;\n margin-bottom: 0;\n }\n\n ", " + ", ",\n ", " + ", " {\n float: left;\n }\n\n ", " + ", " + span + ", "::after,\n ", " + ", " + span + ", "::after,\n ", " + ", " + ", "::after,\n ", " + ", " + span + ", "::after,\n ", " + ", " + ", "::after,\n ", " + ", " + span + ", "::after {\n visibility: hidden;\n display: block;\n font-size: 0;\n content: ' ';\n clear: both;\n height: 0;\n }\n\n ", " + ", " + ", " + *,\n ", " + ", " + ", " + span + *,\n ", " + ", " + ", " + *,\n ", " + ", " + ", " + span + *,\n ", " + ", " + span + ", " + *,\n ", " + ", " + span + ", " + *,\n ", " + ", " + span + ", " + *,\n ", " + ", " + span + ", " + *,\n ", " + ", " + ", " + * > *,\n ", " + ", " + ", " + span + * > *,\n ", " + ", " + ", " + * > *,\n ", " + ", " + ", " + span + * > *,\n ", " + ", " + span + ", " + * > *,\n ", " + ", " + span + ", " + * > *,\n ", " + ", " + span + ", " + * > *,\n ", " + ", " + span + ", " + * > *,\n ", " + ", " + *,\n ", " + ", " + span + * {\n margin-top: 0;\n }\n"])), hideCaretModifier, gapCursor, gapCursorBlink, wrapRight, gapCursor, gapCursor, wrapLeft, wrapLeft, gapCursor, wrapRight, wrapRight, gapCursor, wrapLeft, wrapRight, gapCursor, wrapLeft, wrapRight, gapCursor, wrapRight, wrapLeft, gapCursor, wrapRight, wrapLeft, wrapLeft, gapCursor, wrapRight, wrapLeft, gapCursor, wrapRight, wrapRight, gapCursor, wrapLeft, wrapRight, gapCursor, wrapLeft, wrapLeft, gapCursor, wrapLeft, gapCursor, wrapRight, wrapLeft, gapCursor, wrapRight, wrapRight, gapCursor, wrapLeft, wrapRight, gapCursor, wrapLeft, gapCursor, wrapRight, wrapLeft, gapCursor, wrapRight, wrapLeft, gapCursor, wrapLeft, wrapRight, gapCursor, wrapLeft, wrapRight, wrapLeft, gapCursor, wrapRight, gapCursor, gapCursor, wrapLeft, wrapRight, gapCursor, wrapRight, wrapLeft, wrapLeft, gapCursor, wrapRight, wrapLeft, gapCursor, wrapRight, wrapRight, gapCursor, wrapLeft, wrapRight, gapCursor, wrapLeft, wrapLeft, gapCursor, wrapRight, wrapLeft, gapCursor, wrapRight, wrapRight, gapCursor, wrapLeft, wrapRight, gapCursor, wrapLeft, wrapLeft, gapCursor, wrapRight, wrapRight, gapCursor, wrapLeft, gapCursor, wrapLeft, wrapRight, gapCursor, wrapRight, wrapLeft, wrapLeft, gapCursor, wrapRight, wrapLeft, gapCursor, wrapRight, wrapRight, gapCursor, wrapLeft, wrapRight, gapCursor, wrapLeft, wrapLeft, gapCursor, wrapRight, wrapRight, gapCursor, wrapLeft, gapCursor, wrapLeft, wrapRight, gapCursor, wrapRight, wrapLeft, prosemirrorwidget, gapCursor, prosemirrorwidget, gapCursor);
|
|
19
19
|
exports.gapCursorStyles = gapCursorStyles;
|
|
@@ -85,9 +85,9 @@ var toDOM = function toDOM(view, getPos) {
|
|
|
85
85
|
if (nodeStart !== 0 || node && node.type.name === 'table') {
|
|
86
86
|
gapCursor.style.marginTop = style.getPropertyValue('margin-top');
|
|
87
87
|
}
|
|
88
|
-
var
|
|
89
|
-
if (
|
|
90
|
-
gapCursor.setAttribute('layout',
|
|
88
|
+
var layoutMode = node && (0, _utils.getLayoutModeFromTargetNode)(node);
|
|
89
|
+
if (layoutMode) {
|
|
90
|
+
gapCursor.setAttribute('layout', layoutMode);
|
|
91
91
|
gapCursor.style.width = "".concat(measureWidth(style), "px");
|
|
92
92
|
} else {
|
|
93
93
|
mutateElementStyle(gapCursor, style, selection.side);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.getLayoutModeFromTargetNode = getLayoutModeFromTargetNode;
|
|
7
7
|
exports.getMediaNearPos = getMediaNearPos;
|
|
8
8
|
exports.isTextBlockNearPos = exports.isLeftCursor = exports.isIgnoredClick = void 0;
|
|
9
9
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
@@ -68,7 +68,7 @@ var isTextBlockNearPos = function isTextBlockNearPos(doc, schema, $pos, dir) {
|
|
|
68
68
|
return false;
|
|
69
69
|
};
|
|
70
70
|
exports.isTextBlockNearPos = isTextBlockNearPos;
|
|
71
|
-
function
|
|
71
|
+
function getLayoutModeFromTargetNode(node) {
|
|
72
72
|
var layout;
|
|
73
73
|
if (node.attrs.layout) {
|
|
74
74
|
layout = node.attrs.layout;
|
|
@@ -82,7 +82,10 @@ function getBreakoutModeFromTargetNode(node) {
|
|
|
82
82
|
}
|
|
83
83
|
}).attrs.mode;
|
|
84
84
|
}
|
|
85
|
-
if (
|
|
85
|
+
if (node.type.name === 'table' && node.attrs.width) {
|
|
86
|
+
layout = 'fixed-width';
|
|
87
|
+
}
|
|
88
|
+
if (['wide', 'full-width', 'fixed-width'].indexOf(layout) === -1) {
|
|
86
89
|
return '';
|
|
87
90
|
}
|
|
88
91
|
return layout;
|
|
@@ -75,10 +75,10 @@ var plugin = new _safePlugin.SafePlugin({
|
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
var node = isRightCursor ? $from.nodeBefore : $from.nodeAfter;
|
|
78
|
-
var
|
|
78
|
+
var layoutMode = node && (0, _utils2.getLayoutModeFromTargetNode)(node);
|
|
79
79
|
return _view2.DecorationSet.create(doc, [_view2.Decoration.widget(position, _placeGapCursor.toDOM, {
|
|
80
|
-
key: "".concat(_selection.JSON_ID, "-").concat(side, "-").concat(
|
|
81
|
-
side:
|
|
80
|
+
key: "".concat(_selection.JSON_ID, "-").concat(side, "-").concat(layoutMode),
|
|
81
|
+
side: layoutMode ? -1 : 0
|
|
82
82
|
})]);
|
|
83
83
|
}
|
|
84
84
|
return null;
|
|
@@ -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 = "187.19.
|
|
9
|
+
var version = "187.19.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
|
@@ -130,7 +130,10 @@ const mediaPlugin = (options = {}, api) => {
|
|
|
130
130
|
name: 'mediaAltTextKeymap',
|
|
131
131
|
plugin: ({
|
|
132
132
|
schema
|
|
133
|
-
}) =>
|
|
133
|
+
}) => {
|
|
134
|
+
var _api$dependencies$ana2;
|
|
135
|
+
return keymapMediaAltTextPlugin(schema, api === null || api === void 0 ? void 0 : (_api$dependencies$ana2 = api.dependencies.analytics) === null || _api$dependencies$ana2 === void 0 ? void 0 : _api$dependencies$ana2.actions);
|
|
136
|
+
}
|
|
134
137
|
});
|
|
135
138
|
}
|
|
136
139
|
if (options && options.allowLinking) {
|
|
@@ -226,11 +229,11 @@ const mediaPlugin = (options = {}, api) => {
|
|
|
226
229
|
keywords: ['attachment', 'gif', 'media', 'picture', 'image', 'video'],
|
|
227
230
|
icon: () => /*#__PURE__*/React.createElement(IconImages, null),
|
|
228
231
|
action(insert, state) {
|
|
229
|
-
var _api$dependencies$
|
|
232
|
+
var _api$dependencies$ana3;
|
|
230
233
|
const pluginState = pluginKey.getState(state);
|
|
231
234
|
pluginState === null || pluginState === void 0 ? void 0 : pluginState.showMediaPicker();
|
|
232
235
|
const tr = insert('');
|
|
233
|
-
api === null || api === void 0 ? void 0 : (_api$dependencies$
|
|
236
|
+
api === null || api === void 0 ? void 0 : (_api$dependencies$ana3 = api.dependencies.analytics) === null || _api$dependencies$ana3 === void 0 ? void 0 : _api$dependencies$ana3.actions.attachAnalyticsEvent({
|
|
234
237
|
action: ACTION.OPENED,
|
|
235
238
|
actionSubject: ACTION_SUBJECT.PICKER,
|
|
236
239
|
actionSubjectId: ACTION_SUBJECT_ID.PICKER_CLOUD,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { createCommand } from '.';
|
|
2
2
|
import { isSelectionMediaSingleNode, getMediaNodeFromSelection } from '../../utils/media-common';
|
|
3
|
-
import { ACTION_SUBJECT, EVENT_TYPE,
|
|
3
|
+
import { ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID, ACTION } from '@atlaskit/editor-common/analytics';
|
|
4
|
+
import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
|
|
4
5
|
const createCommandWithAnalytics = (actionType, action, transform) => {
|
|
5
|
-
return withAnalytics({
|
|
6
|
+
return editorAnalyticsAPI => withAnalytics(editorAnalyticsAPI, {
|
|
6
7
|
action: actionType,
|
|
7
8
|
actionSubject: ACTION_SUBJECT.MEDIA,
|
|
8
9
|
actionSubjectId: ACTION_SUBJECT_ID.ALT_TEXT,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
2
2
|
import * as keymaps from '../../../../keymaps';
|
|
3
3
|
import { openMediaAltTextMenu, closeMediaAltTextMenu } from './commands';
|
|
4
|
-
export default function keymapPlugin(schema) {
|
|
4
|
+
export default function keymapPlugin(schema, editorAnalyticsAPI) {
|
|
5
5
|
const list = {};
|
|
6
|
-
keymaps.bindKeymapWithCommand(keymaps.addAltText.common, openMediaAltTextMenu, list);
|
|
6
|
+
keymaps.bindKeymapWithCommand(keymaps.addAltText.common, openMediaAltTextMenu(editorAnalyticsAPI), list);
|
|
7
7
|
keymaps.bindKeymapWithCommand(keymaps.escape.common, closeMediaAltTextMenu, list);
|
|
8
8
|
return keymap(list);
|
|
9
9
|
}
|
|
@@ -16,7 +16,7 @@ import * as helpers from '../commands/helpers';
|
|
|
16
16
|
import { updateMediaSingleNodeAttrs } from '../commands/helpers';
|
|
17
17
|
import { stateKey } from './plugin-key';
|
|
18
18
|
import PickerFacade from '../picker-facade';
|
|
19
|
-
import { INPUT_METHOD } from '
|
|
19
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
20
20
|
import { isInEmptyLine } from '../../../utils/document';
|
|
21
21
|
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
22
22
|
import { isInListItem } from '../../../utils';
|
|
@@ -170,16 +170,16 @@ export class MediaPluginStateImplementation {
|
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
172
|
if (isMediaSingle(state.schema, mediaStateWithContext.fileMimeType)) {
|
|
173
|
-
var _this$pluginInjection;
|
|
173
|
+
var _this$pluginInjection, _pluginInjectionApi$d, _pluginInjectionApi$d2;
|
|
174
174
|
// read width state right before inserting to get up-to-date and define values
|
|
175
175
|
const widthPluginState = (_this$pluginInjection = this.pluginInjectionApi) === null || _this$pluginInjection === void 0 ? void 0 : _this$pluginInjection.dependencies.width.sharedState.currentState();
|
|
176
|
-
insertMediaSingleNode(this.view, mediaStateWithContext, this.getInputMethod(pickerType), collection, this.mediaOptions && this.mediaOptions.alignLeftOnInsert, this.newInsertionBehaviour, widthPluginState);
|
|
176
|
+
insertMediaSingleNode(this.view, mediaStateWithContext, this.getInputMethod(pickerType), collection, this.mediaOptions && this.mediaOptions.alignLeftOnInsert, this.newInsertionBehaviour, widthPluginState, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d === void 0 ? void 0 : (_pluginInjectionApi$d2 = _pluginInjectionApi$d.analytics) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.actions);
|
|
177
177
|
} else if (getMediaFeatureFlag('mediaInline', (_this$mediaOptions2 = this.mediaOptions) === null || _this$mediaOptions2 === void 0 ? void 0 : _this$mediaOptions2.featureFlags) && !isInEmptyLine(state) && (!isInsidePotentialEmptyParagraph(state) || isInListItem(state)) && canInsertMediaInline(state)) {
|
|
178
|
-
var _pluginInjectionApi$d, _pluginInjectionApi$d2;
|
|
179
|
-
insertMediaInlineNode(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d === void 0 ? void 0 : (_pluginInjectionApi$d2 = _pluginInjectionApi$d.analytics) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.actions)(this.view, mediaStateWithContext, collection, this.getInputMethod(pickerType));
|
|
180
|
-
} else {
|
|
181
178
|
var _pluginInjectionApi$d3, _pluginInjectionApi$d4;
|
|
182
|
-
|
|
179
|
+
insertMediaInlineNode(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d3 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d3 === void 0 ? void 0 : (_pluginInjectionApi$d4 = _pluginInjectionApi$d3.analytics) === null || _pluginInjectionApi$d4 === void 0 ? void 0 : _pluginInjectionApi$d4.actions)(this.view, mediaStateWithContext, collection, this.getInputMethod(pickerType));
|
|
180
|
+
} else {
|
|
181
|
+
var _pluginInjectionApi$d5, _pluginInjectionApi$d6;
|
|
182
|
+
insertMediaGroupNode(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d5 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d5 === void 0 ? void 0 : (_pluginInjectionApi$d6 = _pluginInjectionApi$d5.analytics) === null || _pluginInjectionApi$d6 === void 0 ? void 0 : _pluginInjectionApi$d6.actions)(this.view, [mediaStateWithContext], collection, this.getInputMethod(pickerType));
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
// do events when media state changes
|
|
@@ -6,7 +6,7 @@ import AltTextEdit, { CONTAINER_WIDTH_IN_PX } from '../pm-plugins/alt-text/ui/Al
|
|
|
6
6
|
import { getMediaNodeFromSelection } from '../utils/media-common';
|
|
7
7
|
import { ClassNames } from '../pm-plugins/alt-text/style';
|
|
8
8
|
const testId = 'alt-text-edit-button';
|
|
9
|
-
export const altTextButton = (intl, state) => {
|
|
9
|
+
export const altTextButton = (intl, state, editorAnalyticsAPI) => {
|
|
10
10
|
const mediaNode = getMediaNodeFromSelection(state);
|
|
11
11
|
const message = mediaNode && mediaNode.attrs.alt ? messages.editAltText : messages.altText;
|
|
12
12
|
const title = intl.formatMessage(message);
|
|
@@ -14,7 +14,7 @@ export const altTextButton = (intl, state) => {
|
|
|
14
14
|
title,
|
|
15
15
|
id: 'editor.media.altText',
|
|
16
16
|
type: 'button',
|
|
17
|
-
onClick: openMediaAltTextMenu,
|
|
17
|
+
onClick: openMediaAltTextMenu(editorAnalyticsAPI),
|
|
18
18
|
showTitle: true,
|
|
19
19
|
testId,
|
|
20
20
|
tooltipContent: /*#__PURE__*/React.createElement(ToolTipContent, {
|