@atlaskit/editor-common 78.27.1 → 78.28.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.
Files changed (66) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/dist/cjs/analytics/types/enums.js +1 -0
  3. package/dist/cjs/clipboard/index.js +29 -1
  4. package/dist/cjs/extensions/module-helpers.js +1 -0
  5. package/dist/cjs/media/messages/comments.js +1 -1
  6. package/dist/cjs/media-single/CommentBadge.js +23 -3
  7. package/dist/cjs/messages/insert-block.js +4 -4
  8. package/dist/cjs/monitoring/error.js +1 -1
  9. package/dist/cjs/preset/{core-plugin.js → core-plugin/index.js} +15 -1
  10. package/dist/cjs/preset/core-plugin/requestDocument.js +62 -0
  11. package/dist/cjs/preset/core-plugin/types.js +5 -0
  12. package/dist/cjs/ui/DropList/index.js +1 -1
  13. package/dist/cjs/ui/MultiBodiedExtension/index.js +0 -3
  14. package/dist/es2019/analytics/types/enums.js +1 -0
  15. package/dist/es2019/clipboard/index.js +29 -1
  16. package/dist/es2019/extensions/module-helpers.js +1 -0
  17. package/dist/es2019/media/messages/comments.js +1 -1
  18. package/dist/es2019/media-single/CommentBadge.js +23 -4
  19. package/dist/es2019/messages/insert-block.js +4 -4
  20. package/dist/es2019/monitoring/error.js +1 -1
  21. package/dist/es2019/preset/{core-plugin.js → core-plugin/index.js} +15 -1
  22. package/dist/es2019/preset/core-plugin/requestDocument.js +51 -0
  23. package/dist/es2019/preset/core-plugin/types.js +1 -0
  24. package/dist/es2019/ui/DropList/index.js +1 -1
  25. package/dist/es2019/ui/MultiBodiedExtension/index.js +0 -3
  26. package/dist/esm/analytics/types/enums.js +1 -0
  27. package/dist/esm/clipboard/index.js +29 -1
  28. package/dist/esm/extensions/module-helpers.js +1 -0
  29. package/dist/esm/media/messages/comments.js +1 -1
  30. package/dist/esm/media-single/CommentBadge.js +24 -4
  31. package/dist/esm/messages/insert-block.js +4 -4
  32. package/dist/esm/monitoring/error.js +1 -1
  33. package/dist/esm/preset/{core-plugin.js → core-plugin/index.js} +15 -1
  34. package/dist/esm/preset/core-plugin/requestDocument.js +54 -0
  35. package/dist/esm/preset/core-plugin/types.js +1 -0
  36. package/dist/esm/ui/DropList/index.js +1 -1
  37. package/dist/esm/ui/MultiBodiedExtension/index.js +0 -3
  38. package/dist/types/analytics/types/cut-copy-events.d.ts +7 -2
  39. package/dist/types/analytics/types/enums.d.ts +2 -1
  40. package/dist/types/analytics/types/extension-events.d.ts +6 -1
  41. package/dist/types/analytics/types/insert-events.d.ts +1 -0
  42. package/dist/types/card/cardOptions.d.ts +6 -0
  43. package/dist/types/card/index.d.ts +1 -1
  44. package/dist/types/extensions/types/utils.d.ts +2 -1
  45. package/dist/types/media-single/CommentBadge.d.ts +4 -1
  46. package/dist/types/preset/core-plugin/index.d.ts +6 -0
  47. package/dist/types/preset/core-plugin/requestDocument.d.ts +7 -0
  48. package/dist/types/preset/core-plugin/types.d.ts +59 -0
  49. package/dist/types/preset/plugin-injection-api.d.ts +1 -1
  50. package/dist/types/types/next-editor-plugin.d.ts +2 -2
  51. package/dist/types-ts4.5/analytics/types/cut-copy-events.d.ts +7 -2
  52. package/dist/types-ts4.5/analytics/types/enums.d.ts +2 -1
  53. package/dist/types-ts4.5/analytics/types/extension-events.d.ts +6 -1
  54. package/dist/types-ts4.5/analytics/types/insert-events.d.ts +1 -0
  55. package/dist/types-ts4.5/card/cardOptions.d.ts +6 -0
  56. package/dist/types-ts4.5/card/index.d.ts +1 -1
  57. package/dist/types-ts4.5/extensions/types/utils.d.ts +2 -1
  58. package/dist/types-ts4.5/media-single/CommentBadge.d.ts +4 -1
  59. package/dist/types-ts4.5/preset/core-plugin/index.d.ts +6 -0
  60. package/dist/types-ts4.5/preset/core-plugin/requestDocument.d.ts +7 -0
  61. package/dist/types-ts4.5/preset/core-plugin/types.d.ts +59 -0
  62. package/dist/types-ts4.5/preset/plugin-injection-api.d.ts +2 -2
  63. package/dist/types-ts4.5/types/next-editor-plugin.d.ts +2 -2
  64. package/package.json +4 -4
  65. package/dist/types/preset/core-plugin.d.ts +0 -39
  66. package/dist/types-ts4.5/preset/core-plugin.d.ts +0 -39
@@ -1,7 +1,6 @@
1
1
  /** @jsx jsx */
2
2
 
3
3
  import { css } from '@emotion/react';
4
- import { N30, N40 } from '@atlaskit/theme/colors';
5
4
  // Wraps the navigation bar and extensionFrames
6
5
  const mbeExtensionContainer = css({
7
6
  background: 'transparent !important',
@@ -34,7 +33,6 @@ const mbeNavigation = css({
34
33
  borderTopRightRadius: "var(--ds-border-radius, 3px)",
35
34
  userSelect: 'none',
36
35
  WebkitUserModify: 'read-only',
37
- border: `1px solid ${`var(--ds-border, ${N40})`}`,
38
36
  borderBottom: 'none !important',
39
37
  background: "var(--ds-surface, white)",
40
38
  marginLeft: "var(--ds-space-100, 8px)",
@@ -49,7 +47,6 @@ const mbeNavigation = css({
49
47
  });
50
48
  const extensionFrameContent = css({
51
49
  padding: `${"var(--ds-space-100, 8px)"} !important`,
52
- border: `1px solid ${`var(--ds-border, ${N30})`}`,
53
50
  display: 'block',
54
51
  minHeight: '100px',
55
52
  background: "var(--ds-surface, white)",
@@ -224,6 +224,7 @@ export var ACTION_SUBJECT = /*#__PURE__*/function (ACTION_SUBJECT) {
224
224
  ACTION_SUBJECT["TOOLTIP"] = "tooltip";
225
225
  ACTION_SUBJECT["LOOM"] = "loom";
226
226
  ACTION_SUBJECT["MULTI_BODIED_EXTENSION"] = "multiBodiedExtension";
227
+ ACTION_SUBJECT["BODIED_EXTENSION"] = "bodiedExtension";
227
228
  return ACTION_SUBJECT;
228
229
  }({});
229
230
  export var ACTION_SUBJECT_ID = /*#__PURE__*/function (ACTION_SUBJECT_ID) {
@@ -12,6 +12,12 @@ var isClipboardApiSupported = function isClipboardApiSupported() {
12
12
  var isIEClipboardApiSupported = function isIEClipboardApiSupported() {
13
13
  return window.clipboardData && typeof window.clipboardData.setData === 'function';
14
14
  };
15
+ var isExtensionNode = function isExtensionNode(node) {
16
+ if (node === 'extension' || node === 'bodiedExtension' || node === 'inlineExtension' || node === 'multiBodiedExtension') {
17
+ return true;
18
+ }
19
+ return false;
20
+ };
15
21
  export var copyToClipboard = /*#__PURE__*/function () {
16
22
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(textToCopy) {
17
23
  return _regeneratorRuntime.wrap(function _callee$(_context) {
@@ -126,11 +132,21 @@ export var getAnalyticsPayload = function getAnalyticsPayload(state, action) {
126
132
  doc = state.doc;
127
133
  var selectionAnalyticsPayload = getNodeSelectionAnalyticsPayload(selection) || getRangeSelectionAnalyticsPayload(selection, doc) || getAllSelectionAnalyticsPayload(selection) || getCellSelectionAnalyticsPayload(state);
128
134
  if (selectionAnalyticsPayload) {
135
+ var _attributes;
129
136
  var selectionActionSubjectId = selectionAnalyticsPayload.actionSubjectId;
137
+ var node = (_attributes = selectionAnalyticsPayload.attributes) === null || _attributes === void 0 ? void 0 : _attributes.node;
130
138
  var content = [];
139
+ var extensionType;
140
+ var extensionKey;
131
141
  switch (selectionActionSubjectId) {
132
142
  case ACTION_SUBJECT_ID.NODE:
133
- content.push(selectionAnalyticsPayload.attributes.node);
143
+ if (node) {
144
+ content.push(node);
145
+ if (isExtensionNode(node)) {
146
+ extensionType = selection.node.attrs.extensionType;
147
+ extensionKey = selection.node.attrs.extensionKey;
148
+ }
149
+ }
134
150
  break;
135
151
  case ACTION_SUBJECT_ID.RANGE:
136
152
  content.push.apply(content, _toConsumableArray(selectionAnalyticsPayload.attributes.nodes));
@@ -146,6 +162,18 @@ export var getAnalyticsPayload = function getAnalyticsPayload(state, action) {
146
162
  break;
147
163
  }
148
164
  }
165
+ if (isExtensionNode(node)) {
166
+ return {
167
+ eventType: EVENT_TYPE.TRACK,
168
+ action: action,
169
+ actionSubject: ACTION_SUBJECT.DOCUMENT,
170
+ attributes: {
171
+ content: content,
172
+ extensionKey: extensionKey,
173
+ extensionType: extensionType
174
+ }
175
+ };
176
+ }
149
177
  return {
150
178
  eventType: EVENT_TYPE.TRACK,
151
179
  action: action,
@@ -25,6 +25,7 @@ export function buildMenuItem(manifest, extensionModule) {
25
25
  key: key,
26
26
  title: title,
27
27
  extensionType: manifest.type,
28
+ extensionKey: manifest.key,
28
29
  keywords: extensionModule.keywords || manifest.keywords || [],
29
30
  featured: extensionModule.featured || false,
30
31
  categories: extensionModule.categories || manifest.categories || [],
@@ -7,7 +7,7 @@ export var commentMessages = defineMessages({
7
7
  },
8
8
  viewCommentsOnMedia: {
9
9
  id: 'fabric.editor.viewCommentOnMedia',
10
- defaultMessage: 'View comment',
10
+ defaultMessage: 'View comments',
11
11
  description: 'View a existing comment for this media (image/video)'
12
12
  },
13
13
  viewAndAddCommentsOnMedia: {
@@ -1,12 +1,13 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  /** @jsx jsx */
3
- import { useEffect, useState } from 'react';
3
+ import { useEffect, useMemo, useState } from 'react';
4
4
  import { css, jsx } from '@emotion/react';
5
5
  import debounce from 'lodash/debounce';
6
6
  import { CustomThemeButton } from '@atlaskit/button';
7
7
  import { akEditorUnitZIndex } from '@atlaskit/editor-shared-styles';
8
8
  import CommentIcon from '@atlaskit/icon/glyph/comment';
9
9
  import { layers } from '@atlaskit/theme/constants';
10
+ import Tooltip from '@atlaskit/tooltip';
10
11
  import { commentMessages as messages } from '../media';
11
12
  var commentBadgeWrapper = css({
12
13
  position: 'absolute',
@@ -28,15 +29,19 @@ export var CommentBadge = function CommentBadge(_ref) {
28
29
  var intl = _ref.intl,
29
30
  width = _ref.width,
30
31
  height = _ref.height,
32
+ _ref$status = _ref.status,
33
+ status = _ref$status === void 0 ? 'default' : _ref$status,
31
34
  mediaElement = _ref.mediaElement,
32
35
  onClick = _ref.onClick,
36
+ onMouseEnter = _ref.onMouseEnter,
37
+ onMouseLeave = _ref.onMouseLeave,
33
38
  _ref$isEditor = _ref.isEditor,
34
39
  isEditor = _ref$isEditor === void 0 ? false : _ref$isEditor;
35
40
  var _useState = useState(getBadgeSize(width, height)),
36
41
  _useState2 = _slicedToArray(_useState, 2),
37
42
  badgeSize = _useState2[0],
38
43
  setBadgeSize = _useState2[1];
39
- var title = intl.formatMessage(messages.viewAndAddCommentsOnMedia);
44
+ var title = intl.formatMessage(messages.viewCommentsOnMedia);
40
45
  useEffect(function () {
41
46
  var observer = new ResizeObserver(debounce(function (entries) {
42
47
  var _entries = _slicedToArray(entries, 1),
@@ -54,21 +59,36 @@ export var CommentBadge = function CommentBadge(_ref) {
54
59
  };
55
60
  }, [mediaElement]);
56
61
  var badgeDimensions = badgeSize === 'medium' ? '24px' : '16px';
62
+ var colourToken = useMemo(function () {
63
+ switch (status) {
64
+ case 'active':
65
+ return "var(--ds-background-accent-yellow-subtlest-pressed, #F5CD47)";
66
+ case 'entered':
67
+ return "var(--ds-background-accent-yellow-subtlest-hovered, #F8E6A0)";
68
+ default:
69
+ return "var(--ds-background-accent-yellow-subtlest, #FFF7D6)";
70
+ }
71
+ }, [status]);
57
72
  return jsx("div", {
58
73
  css: isEditor ? [commentBadgeWrapper, commentBadgeEditorOverrides] : commentBadgeWrapper
74
+ }, jsx(Tooltip, {
75
+ position: "top",
76
+ content: title
59
77
  }, jsx(CustomThemeButton, {
60
78
  style: {
61
79
  height: badgeDimensions,
62
80
  width: badgeDimensions,
63
- background: "var(--ds-background-accent-yellow-subtler, #F8E6A0)",
81
+ background: colourToken,
64
82
  display: 'flex',
65
83
  justifyContent: 'center',
66
84
  alignItems: 'center'
67
85
  },
68
86
  onClick: onClick,
87
+ onMouseEnter: onMouseEnter,
88
+ onMouseLeave: onMouseLeave,
69
89
  iconAfter: jsx(CommentIcon, {
70
90
  label: title,
71
91
  size: badgeSize
72
92
  })
73
- }));
93
+ })));
74
94
  };
@@ -192,8 +192,8 @@ export var toolbarInsertBlockMessages = defineMessages({
192
192
  },
193
193
  recordVideo: {
194
194
  id: 'fabric.editor.recordVideo',
195
- defaultMessage: 'Record video',
196
- description: 'Record video using Loom'
195
+ defaultMessage: 'Record a Loom video',
196
+ description: 'Record a Loom video'
197
197
  },
198
198
  addLoomVideo: {
199
199
  id: 'fabric.editor.addLoomVideo',
@@ -202,7 +202,7 @@ export var toolbarInsertBlockMessages = defineMessages({
202
202
  },
203
203
  recordVideoDescription: {
204
204
  id: 'fabric.editor.recordVideo.description',
205
- defaultMessage: 'Record video using Loom',
206
- description: 'Record video using Loom'
205
+ defaultMessage: 'Record your screen and camera',
206
+ description: 'Record your screen and camera'
207
207
  }
208
208
  });
@@ -6,7 +6,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
6
6
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
7
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
8
8
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
9
- var packageVersion = "78.27.1";
9
+ var packageVersion = "78.28.1";
10
10
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
11
11
  // Remove URL as it has UGC
12
12
  // TODO: Sanitise the URL instead of just removing it
@@ -1,4 +1,5 @@
1
- import { editorCommandToPMCommand } from './editor-commands';
1
+ import { editorCommandToPMCommand } from '../editor-commands';
2
+ import { scheduleDocumentRequest } from './requestDocument';
2
3
  /**
3
4
  * Core plugin that is always included in the preset.
4
5
  * Allows for executing `EditorCommand` and other core functionality.
@@ -35,6 +36,19 @@ export var corePlugin = function corePlugin(_ref) {
35
36
  }
36
37
  editorView.dom.blur();
37
38
  return true;
39
+ },
40
+ requestDocument: function requestDocument(onReceive, options) {
41
+ var _config$getEditorView;
42
+ var view = (_config$getEditorView = config === null || config === void 0 ? void 0 : config.getEditorView()) !== null && _config$getEditorView !== void 0 ? _config$getEditorView : null;
43
+ scheduleDocumentRequest(view, onReceive, options === null || options === void 0 ? void 0 : options.transformer);
44
+ },
45
+ createTransformer: function createTransformer(cb) {
46
+ var _config$getEditorView2;
47
+ var view = (_config$getEditorView2 = config === null || config === void 0 ? void 0 : config.getEditorView()) !== null && _config$getEditorView2 !== void 0 ? _config$getEditorView2 : null;
48
+ if (!(view !== null && view !== void 0 && view.state.schema)) {
49
+ return undefined;
50
+ }
51
+ return cb(view === null || view === void 0 ? void 0 : view.state.schema);
38
52
  }
39
53
  }
40
54
  };
@@ -0,0 +1,54 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
+ import { JSONTransformer } from '@atlaskit/editor-json-transformer';
3
+ import { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
4
+ var transformer = new JSONTransformer();
5
+ export function toJSON(node) {
6
+ return transformer.encode(node);
7
+ }
8
+
9
+ /**
10
+ * This throttles the callback with requestIdleCallback.
11
+ */
12
+ function createThrottleSchedule(callback) {
13
+ var frameId;
14
+ var lastArgs;
15
+ var wrapperFn = function wrapperFn() {
16
+ var _globalThis$requestId;
17
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
18
+ args[_key] = arguments[_key];
19
+ }
20
+ lastArgs = args;
21
+ if (frameId) {
22
+ return;
23
+ }
24
+
25
+ // If `requestIdleCallback` doesn't exist - fallback to `requestAnimationFrame`
26
+ var delayFunction = (_globalThis$requestId = globalThis.requestIdleCallback) !== null && _globalThis$requestId !== void 0 ? _globalThis$requestId : globalThis.requestAnimationFrame;
27
+ frameId = delayFunction(function () {
28
+ frameId = undefined;
29
+ if (lastArgs) {
30
+ callback.apply(void 0, _toConsumableArray(lastArgs));
31
+ }
32
+ }, {
33
+ timeout: 100
34
+ });
35
+ };
36
+ return wrapperFn;
37
+ }
38
+ export var scheduleDocumentRequest = createThrottleSchedule(returnDocumentRequest);
39
+ function returnDocumentRequest(editorView, callback, transformer) {
40
+ var _editorView$state;
41
+ var _ref = (_editorView$state = editorView === null || editorView === void 0 ? void 0 : editorView.state) !== null && _editorView$state !== void 0 ? _editorView$state : {},
42
+ doc = _ref.doc,
43
+ schema = _ref.schema;
44
+ if (!doc || !schema) {
45
+ return undefined;
46
+ }
47
+ var json = toJSON(doc);
48
+ if (typeof transformer === 'undefined') {
49
+ callback(json);
50
+ } else {
51
+ var nodeSanitized = PMNode.fromJSON(schema, json);
52
+ callback(transformer.encode(nodeSanitized));
53
+ }
54
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -17,7 +17,7 @@ import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@
17
17
  import { N0, N50A, N60A, N900 } from '@atlaskit/theme/colors';
18
18
  import Layer from '../Layer';
19
19
  var packageName = "@atlaskit/editor-common";
20
- var packageVersion = "78.27.1";
20
+ var packageVersion = "78.28.1";
21
21
  var halfFocusRing = 1;
22
22
  var dropOffset = '0, 8';
23
23
  var DropList = /*#__PURE__*/function (_Component) {
@@ -1,7 +1,6 @@
1
1
  /** @jsx jsx */
2
2
 
3
3
  import { css } from '@emotion/react';
4
- import { N30, N40 } from '@atlaskit/theme/colors';
5
4
  // Wraps the navigation bar and extensionFrames
6
5
  var mbeExtensionContainer = css({
7
6
  background: 'transparent !important',
@@ -34,7 +33,6 @@ var mbeNavigation = css({
34
33
  borderTopRightRadius: "var(--ds-border-radius, 3px)",
35
34
  userSelect: 'none',
36
35
  WebkitUserModify: 'read-only',
37
- border: "1px solid ".concat("var(--ds-border, ".concat(N40, ")")),
38
36
  borderBottom: 'none !important',
39
37
  background: "var(--ds-surface, white)",
40
38
  marginLeft: "var(--ds-space-100, 8px)",
@@ -49,7 +47,6 @@ var mbeNavigation = css({
49
47
  });
50
48
  var extensionFrameContent = css({
51
49
  padding: "var(--ds-space-100, 8px)".concat(" !important"),
52
- border: "1px solid ".concat("var(--ds-border, ".concat(N30, ")")),
53
50
  display: 'block',
54
51
  minHeight: '100px',
55
52
  background: "var(--ds-surface, white)",
@@ -1,12 +1,17 @@
1
- import { ACTION, ACTION_SUBJECT } from './enums';
2
- import { TrackAEP } from './utils';
1
+ import type { ACTION, ACTION_SUBJECT } from './enums';
2
+ import type { TrackAEP } from './utils';
3
3
  type CopyAEP = TrackAEP<ACTION.COPIED, ACTION_SUBJECT.DOCUMENT, undefined, {
4
4
  content: string[];
5
5
  inputMethod?: string;
6
6
  nodeType?: string;
7
+ extensionType?: string;
8
+ extensionKey?: string;
7
9
  }, undefined>;
8
10
  type CutAEP = TrackAEP<ACTION.CUT, ACTION_SUBJECT.DOCUMENT, undefined, {
9
11
  content: string[];
12
+ nodeType?: string;
13
+ extensionType?: string;
14
+ extensionKey?: string;
10
15
  }, undefined>;
11
16
  export type CutCopyEventPayload = CutAEP | CopyAEP;
12
17
  export {};
@@ -227,7 +227,8 @@ export declare enum ACTION_SUBJECT {
227
227
  LINK = "link",
228
228
  TOOLTIP = "tooltip",
229
229
  LOOM = "loom",
230
- MULTI_BODIED_EXTENSION = "multiBodiedExtension"
230
+ MULTI_BODIED_EXTENSION = "multiBodiedExtension",
231
+ BODIED_EXTENSION = "bodiedExtension"
231
232
  }
232
233
  export declare enum ACTION_SUBJECT_ID {
233
234
  ACTION = "action",
@@ -30,8 +30,13 @@ type ExtensionUpdateAEP = TrackAEP<ACTION.UPDATED | ACTION.ERRORED, ACTION_SUBJE
30
30
  selection: SelectionJson;
31
31
  targetSelectionSource: TARGET_SELECTION_SOURCE;
32
32
  }, INPUT_METHOD.MACRO_BROWSER | INPUT_METHOD.CONFIG_PANEL | INPUT_METHOD.TOOLBAR>;
33
+ type ExtensionDeletedAEP = TrackAEP<ACTION.DELETED, ACTION_SUBJECT.EXTENSION, ExtensionType, {
34
+ extensionType: string;
35
+ extensionKey: string;
36
+ localId: string;
37
+ }, INPUT_METHOD.TOOLBAR>;
33
38
  type ExtensionAPICalledPayload = TrackAEP<ACTION.INVOKED, ACTION_SUBJECT.EXTENSION, ACTION_SUBJECT_ID.EXTENSION_API, {
34
39
  functionName: string;
35
40
  }, INPUT_METHOD.EXTENSION_API>;
36
- export type ExtensionEventPayload = ExtensionUpdateAEP | ExtensionAPICalledPayload;
41
+ export type ExtensionEventPayload = ExtensionUpdateAEP | ExtensionDeletedAEP | ExtensionAPICalledPayload;
37
42
  export {};
@@ -106,6 +106,7 @@ type InsertDateAEP = InsertAEP<ACTION_SUBJECT_ID.DATE, {
106
106
  }, undefined>;
107
107
  type InsertExtensionAEP = InsertAEP<ACTION_SUBJECT_ID.EXTENSION, {
108
108
  extensionType: string;
109
+ extensionKey: string;
109
110
  key: string;
110
111
  inputMethod: INPUT_METHOD.QUICK_INSERT;
111
112
  }, any>;
@@ -1,5 +1,10 @@
1
+ import type { MouseEvent } from 'react';
1
2
  import type { CardProps } from '@atlaskit/smart-card';
2
3
  import type { Providers } from '../provider-factory';
4
+ export type OnClickCallback = ({ event, url, }: {
5
+ event: MouseEvent<HTMLAnchorElement>;
6
+ url?: string;
7
+ }) => void;
3
8
  export interface CardOptions {
4
9
  provider?: Providers['cardProvider'];
5
10
  resolveBeforeMacros?: string[];
@@ -18,6 +23,7 @@ export interface CardOptions {
18
23
  allowAlignment?: boolean;
19
24
  allowWrapping?: boolean;
20
25
  showUpgradeDiscoverability?: boolean;
26
+ onClickCallback?: OnClickCallback;
21
27
  /**
22
28
  * Customises the outbound link to configure user preferences
23
29
  */
@@ -1,4 +1,4 @@
1
- export type { CardOptions } from './cardOptions';
1
+ export type { CardOptions, OnClickCallback } from './cardOptions';
2
2
  export { addLinkMetadata, getLinkMetadataFromTransaction, commandWithMetadata, } from './utils';
3
3
  export { default as buildLayoutButtons, alignmentIcons, wrappingIcons, layoutToMessages, } from './MediaAndEmbedsToolbar';
4
4
  export type { IconMap, LayoutIcon } from './MediaAndEmbedsToolbar';
@@ -1,8 +1,9 @@
1
1
  import type { ADFEntity } from '@atlaskit/adf-utils/types';
2
- import { ExtensionModuleActionHandler, ExtensionType, Icon } from './extension-manifest';
2
+ import type { ExtensionKey, ExtensionModuleActionHandler, ExtensionType, Icon } from './extension-manifest';
3
3
  export type MenuItem = {
4
4
  key: string;
5
5
  extensionType: ExtensionType;
6
+ extensionKey: ExtensionKey;
6
7
  title: string;
7
8
  description?: string;
8
9
  summary?: string;
@@ -5,8 +5,11 @@ export type CommentBadgeProps = {
5
5
  intl: IntlShape;
6
6
  width?: number;
7
7
  height?: number;
8
+ status?: 'default' | 'entered' | 'active';
8
9
  mediaElement?: HTMLElement | null;
9
10
  onClick: (e: React.MouseEvent) => void;
11
+ onMouseEnter?: (e: React.MouseEvent) => void;
12
+ onMouseLeave?: (e: React.MouseEvent) => void;
10
13
  isEditor?: boolean;
11
14
  };
12
- export declare const CommentBadge: ({ intl, width, height, mediaElement, onClick, isEditor, }: CommentBadgeProps) => jsx.JSX.Element;
15
+ export declare const CommentBadge: ({ intl, width, height, status, mediaElement, onClick, onMouseEnter, onMouseLeave, isEditor, }: CommentBadgeProps) => jsx.JSX.Element;
@@ -0,0 +1,6 @@
1
+ import type { CorePlugin } from './types';
2
+ /**
3
+ * Core plugin that is always included in the preset.
4
+ * Allows for executing `EditorCommand` and other core functionality.
5
+ */
6
+ export declare const corePlugin: CorePlugin;
@@ -0,0 +1,7 @@
1
+ import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
2
+ import { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
3
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
+ import type { Transformer } from '../../types';
5
+ import type { InferTransformerResultCallback } from './types';
6
+ export declare function toJSON(node: PMNode): JSONDocNode;
7
+ export declare const scheduleDocumentRequest: <GenericTransformer extends Transformer<any> | undefined>(editorView: EditorView | null, callback: InferTransformerResultCallback<Transformer<any>>, transformer?: Transformer<any> | undefined) => void;
@@ -0,0 +1,59 @@
1
+ import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
2
+ import type { Schema } from '@atlaskit/editor-prosemirror/model';
3
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
+ import type { EditorCommand, NextEditorPlugin, Transformer } from '../../types';
5
+ export type CorePlugin = NextEditorPlugin<'core', {
6
+ pluginConfiguration: {
7
+ getEditorView: () => EditorView | undefined;
8
+ };
9
+ actions: {
10
+ /**
11
+ * Dispatches an EditorCommand to ProseMirror
12
+ *
13
+ * @param command A function (EditorCommand | undefined) that takes an object containing a `Transaction` and returns a `Transaction` if it
14
+ * is successful or `null` if it shouldn't be dispatched.
15
+ * @returns (boolean) if the command was successful in dispatching
16
+ */
17
+ execute: (command: EditorCommand | undefined) => boolean;
18
+ /**
19
+ * Focuses the editor.
20
+ *
21
+ * Calls the focus method of the `EditorView` and scrolls the
22
+ * current selection into view.
23
+ *
24
+ * @returns (boolean) if the focus was successful
25
+ */
26
+ focus: () => boolean;
27
+ /**
28
+ * Blurs the editor.
29
+ *
30
+ * Calls blur on the editor DOM element.
31
+ *
32
+ * @returns (boolean) if the blur was successful
33
+ */
34
+ blur: () => boolean;
35
+ /**
36
+ * Request the editor document.
37
+ * The document will return when available. If called multiple times it will throttle and return the
38
+ * latest document when ready.
39
+ *
40
+ * A transformer can be created using `createTransformer`.
41
+ *
42
+ * @param onReceive Callback to handle the document. Document type based on the transformer.
43
+ * @param options Pass a transformer for the document to be transformed into a different format.
44
+ */
45
+ requestDocument<GenericTransformer extends Transformer<any> = Transformer<JSONDocNode>>(onReceive: (document: TransformerResult<GenericTransformer> | undefined) => void, options?: {
46
+ transformer?: GenericTransformer;
47
+ }): void;
48
+ /**
49
+ * Create a transformer
50
+ *
51
+ * @param schema Schema of the document
52
+ * @returns Transformer which can be used to request a document
53
+ */
54
+ createTransformer<Format>(cb: (schema: Schema) => Transformer<Format>): Transformer<Format> | undefined;
55
+ };
56
+ }>;
57
+ export type TransformerResult<GenericTransformer = Transformer<JSONDocNode>> = GenericTransformer extends Transformer<infer Content> ? Content : JSONDocNode;
58
+ export type InferTransformerResultCallback<T extends Transformer<any> | undefined> = (doc: T extends Transformer<infer U> ? TransformerResult<U> : TransformerResult<JSONDocNode>) => void;
59
+ export type DefaultTransformerResultCallback = (doc: TransformerResult<JSONDocNode> | undefined) => void;
@@ -39,7 +39,7 @@ export declare class EditorPluginInjectionAPI implements PluginInjectionAPIDefin
39
39
  private commandsAPI;
40
40
  private plugins;
41
41
  constructor({ getEditorState, getEditorView }: PluginInjectionAPIProps);
42
- api<T extends NextEditorPlugin<any, any>>(): import("../types/next-editor-plugin").PublicPluginAPI<[NextEditorPlugin<T extends import("./core-plugin").CorePlugin<infer Name extends string, any, any> ? Name : never, T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never>, ..."dependencies" extends keyof (T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never) ? (T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never)["dependencies"] extends (import("./core-plugin").CorePlugin<any, any, any> | import("../types/next-editor-plugin").OptionalPlugin<import("./core-plugin").CorePlugin<any, any, any>>)[] ? Exclude<(T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never)["dependencies"], undefined> : [] : []]>;
42
+ api<T extends NextEditorPlugin<any, any>>(): import("../types/next-editor-plugin").PublicPluginAPI<[NextEditorPlugin<T extends import("../types/next-editor-plugin").NextEditorPluginFunctionOptionalConfigDefinition<infer Name extends string, any, any> ? Name : never, T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never>, ..."dependencies" extends keyof (T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never) ? (T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never)["dependencies"] extends (import("../types/next-editor-plugin").NextEditorPluginFunctionOptionalConfigDefinition<any, any, any> | import("../types/next-editor-plugin").OptionalPlugin<import("../types/next-editor-plugin").NextEditorPluginFunctionOptionalConfigDefinition<any, any, any>>)[] ? Exclude<(T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never)["dependencies"], undefined> : [] : []]>;
43
43
  onEditorViewUpdated: ({ newEditorState, oldEditorState, }: EditorStateDiff) => void;
44
44
  onEditorPluginInitialized: (plugin: NextEditorPluginInitializedType) => void;
45
45
  private addPlugin;
@@ -5,7 +5,7 @@
5
5
  * are put together - but for now `Builder` & `Preset` aim to beinterchangeable.
6
6
  */
7
7
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
8
- import type { CorePlugin } from '../preset/core-plugin';
8
+ import type { CorePlugin } from '../preset/core-plugin/types';
9
9
  import type { EditorCommand, EditorCommandWithMetadata } from './editor-command';
10
10
  import type { EditorPlugin } from './editor-plugin';
11
11
  type IsAny<T> = 0 extends 1 & T ? true : false;
@@ -97,7 +97,7 @@ export type PluginDependenciesAPI<Plugin extends NextEditorPlugin<any, any>> = {
97
97
  commands: Plugin extends NextEditorPlugin<any, infer Metadata> ? ExtractCommandsFromMetadata<Metadata> : never;
98
98
  };
99
99
  export type CreatePluginDependenciesAPI<PluginList extends NextEditorPlugin<any, any>[]> = {
100
- [Plugin in PluginList[number] as `${ExtractPluginName<Plugin>}`]: Plugin extends OptionalPlugin<NextEditorPlugin<any, any>> ? PluginDependenciesAPI<Plugin> | undefined : Plugin extends NextEditorPlugin<any, any> ? PluginDependenciesAPI<Plugin> | undefined : never;
100
+ [Plugin in PluginList[number] as `${ExtractPluginName<Plugin>}`]: Plugin extends OptionalPlugin<NextEditorPlugin<any, any>> ? PluginDependenciesAPI<Plugin> | undefined : Plugin extends NextEditorPlugin<'core', any> ? PluginDependenciesAPI<Plugin> : Plugin extends NextEditorPlugin<any, any> ? PluginDependenciesAPI<Plugin> | undefined : never;
101
101
  };
102
102
  export type PluginWithConfiguration<Plugin> = undefined extends ExtractPluginConfiguration<Plugin> ? [Plugin, ExtractPluginConfiguration<Plugin>?] : [Plugin, ExtractPluginConfiguration<Plugin>];
103
103
  export type MaybePluginName<T extends string> = [T];
@@ -1,12 +1,17 @@
1
- import { ACTION, ACTION_SUBJECT } from './enums';
2
- import { TrackAEP } from './utils';
1
+ import type { ACTION, ACTION_SUBJECT } from './enums';
2
+ import type { TrackAEP } from './utils';
3
3
  type CopyAEP = TrackAEP<ACTION.COPIED, ACTION_SUBJECT.DOCUMENT, undefined, {
4
4
  content: string[];
5
5
  inputMethod?: string;
6
6
  nodeType?: string;
7
+ extensionType?: string;
8
+ extensionKey?: string;
7
9
  }, undefined>;
8
10
  type CutAEP = TrackAEP<ACTION.CUT, ACTION_SUBJECT.DOCUMENT, undefined, {
9
11
  content: string[];
12
+ nodeType?: string;
13
+ extensionType?: string;
14
+ extensionKey?: string;
10
15
  }, undefined>;
11
16
  export type CutCopyEventPayload = CutAEP | CopyAEP;
12
17
  export {};
@@ -227,7 +227,8 @@ export declare enum ACTION_SUBJECT {
227
227
  LINK = "link",
228
228
  TOOLTIP = "tooltip",
229
229
  LOOM = "loom",
230
- MULTI_BODIED_EXTENSION = "multiBodiedExtension"
230
+ MULTI_BODIED_EXTENSION = "multiBodiedExtension",
231
+ BODIED_EXTENSION = "bodiedExtension"
231
232
  }
232
233
  export declare enum ACTION_SUBJECT_ID {
233
234
  ACTION = "action",
@@ -30,8 +30,13 @@ type ExtensionUpdateAEP = TrackAEP<ACTION.UPDATED | ACTION.ERRORED, ACTION_SUBJE
30
30
  selection: SelectionJson;
31
31
  targetSelectionSource: TARGET_SELECTION_SOURCE;
32
32
  }, INPUT_METHOD.MACRO_BROWSER | INPUT_METHOD.CONFIG_PANEL | INPUT_METHOD.TOOLBAR>;
33
+ type ExtensionDeletedAEP = TrackAEP<ACTION.DELETED, ACTION_SUBJECT.EXTENSION, ExtensionType, {
34
+ extensionType: string;
35
+ extensionKey: string;
36
+ localId: string;
37
+ }, INPUT_METHOD.TOOLBAR>;
33
38
  type ExtensionAPICalledPayload = TrackAEP<ACTION.INVOKED, ACTION_SUBJECT.EXTENSION, ACTION_SUBJECT_ID.EXTENSION_API, {
34
39
  functionName: string;
35
40
  }, INPUT_METHOD.EXTENSION_API>;
36
- export type ExtensionEventPayload = ExtensionUpdateAEP | ExtensionAPICalledPayload;
41
+ export type ExtensionEventPayload = ExtensionUpdateAEP | ExtensionDeletedAEP | ExtensionAPICalledPayload;
37
42
  export {};
@@ -106,6 +106,7 @@ type InsertDateAEP = InsertAEP<ACTION_SUBJECT_ID.DATE, {
106
106
  }, undefined>;
107
107
  type InsertExtensionAEP = InsertAEP<ACTION_SUBJECT_ID.EXTENSION, {
108
108
  extensionType: string;
109
+ extensionKey: string;
109
110
  key: string;
110
111
  inputMethod: INPUT_METHOD.QUICK_INSERT;
111
112
  }, any>;
@@ -1,5 +1,10 @@
1
+ import type { MouseEvent } from 'react';
1
2
  import type { CardProps } from '@atlaskit/smart-card';
2
3
  import type { Providers } from '../provider-factory';
4
+ export type OnClickCallback = ({ event, url, }: {
5
+ event: MouseEvent<HTMLAnchorElement>;
6
+ url?: string;
7
+ }) => void;
3
8
  export interface CardOptions {
4
9
  provider?: Providers['cardProvider'];
5
10
  resolveBeforeMacros?: string[];
@@ -18,6 +23,7 @@ export interface CardOptions {
18
23
  allowAlignment?: boolean;
19
24
  allowWrapping?: boolean;
20
25
  showUpgradeDiscoverability?: boolean;
26
+ onClickCallback?: OnClickCallback;
21
27
  /**
22
28
  * Customises the outbound link to configure user preferences
23
29
  */
@@ -1,4 +1,4 @@
1
- export type { CardOptions } from './cardOptions';
1
+ export type { CardOptions, OnClickCallback } from './cardOptions';
2
2
  export { addLinkMetadata, getLinkMetadataFromTransaction, commandWithMetadata, } from './utils';
3
3
  export { default as buildLayoutButtons, alignmentIcons, wrappingIcons, layoutToMessages, } from './MediaAndEmbedsToolbar';
4
4
  export type { IconMap, LayoutIcon } from './MediaAndEmbedsToolbar';