@atlaskit/editor-common 78.27.1 → 78.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/dist/cjs/media/messages/comments.js +1 -1
  3. package/dist/cjs/media-single/CommentBadge.js +23 -3
  4. package/dist/cjs/messages/insert-block.js +4 -4
  5. package/dist/cjs/monitoring/error.js +1 -1
  6. package/dist/cjs/preset/{core-plugin.js → core-plugin/index.js} +15 -1
  7. package/dist/cjs/preset/core-plugin/requestDocument.js +62 -0
  8. package/dist/cjs/preset/core-plugin/types.js +5 -0
  9. package/dist/cjs/ui/DropList/index.js +1 -1
  10. package/dist/cjs/ui/MultiBodiedExtension/index.js +0 -3
  11. package/dist/es2019/media/messages/comments.js +1 -1
  12. package/dist/es2019/media-single/CommentBadge.js +23 -4
  13. package/dist/es2019/messages/insert-block.js +4 -4
  14. package/dist/es2019/monitoring/error.js +1 -1
  15. package/dist/es2019/preset/{core-plugin.js → core-plugin/index.js} +15 -1
  16. package/dist/es2019/preset/core-plugin/requestDocument.js +51 -0
  17. package/dist/es2019/preset/core-plugin/types.js +1 -0
  18. package/dist/es2019/ui/DropList/index.js +1 -1
  19. package/dist/es2019/ui/MultiBodiedExtension/index.js +0 -3
  20. package/dist/esm/media/messages/comments.js +1 -1
  21. package/dist/esm/media-single/CommentBadge.js +24 -4
  22. package/dist/esm/messages/insert-block.js +4 -4
  23. package/dist/esm/monitoring/error.js +1 -1
  24. package/dist/esm/preset/{core-plugin.js → core-plugin/index.js} +15 -1
  25. package/dist/esm/preset/core-plugin/requestDocument.js +54 -0
  26. package/dist/esm/preset/core-plugin/types.js +1 -0
  27. package/dist/esm/ui/DropList/index.js +1 -1
  28. package/dist/esm/ui/MultiBodiedExtension/index.js +0 -3
  29. package/dist/types/card/cardOptions.d.ts +6 -0
  30. package/dist/types/card/index.d.ts +1 -1
  31. package/dist/types/media-single/CommentBadge.d.ts +4 -1
  32. package/dist/types/preset/core-plugin/index.d.ts +6 -0
  33. package/dist/types/preset/core-plugin/requestDocument.d.ts +7 -0
  34. package/dist/types/preset/core-plugin/types.d.ts +59 -0
  35. package/dist/types/preset/plugin-injection-api.d.ts +1 -1
  36. package/dist/types/types/next-editor-plugin.d.ts +2 -2
  37. package/dist/types-ts4.5/card/cardOptions.d.ts +6 -0
  38. package/dist/types-ts4.5/card/index.d.ts +1 -1
  39. package/dist/types-ts4.5/media-single/CommentBadge.d.ts +4 -1
  40. package/dist/types-ts4.5/preset/core-plugin/index.d.ts +6 -0
  41. package/dist/types-ts4.5/preset/core-plugin/requestDocument.d.ts +7 -0
  42. package/dist/types-ts4.5/preset/core-plugin/types.d.ts +59 -0
  43. package/dist/types-ts4.5/preset/plugin-injection-api.d.ts +2 -2
  44. package/dist/types-ts4.5/types/next-editor-plugin.d.ts +2 -2
  45. package/package.json +4 -4
  46. package/dist/types/preset/core-plugin.d.ts +0 -39
  47. package/dist/types-ts4.5/preset/core-plugin.d.ts +0 -39
package/CHANGELOG.md CHANGED
@@ -1,5 +1,36 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 78.28.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#90742](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/90742) [`f893b885cc0a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f893b885cc0a) - [ux] Add comment on media badge states
8
+ - [#88342](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/88342) [`104d7d1b8191`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/104d7d1b8191) - Introducing requestDocument API on core plugin which can be used to get the document using the editor API.
9
+
10
+ This is intended to replace the `editorActions.getValue()`.
11
+
12
+ Using the editor API you can do:
13
+
14
+ ```ts
15
+ const { editorApi, preset } = usePreset(() => createDefaultPreset({}));
16
+
17
+ //
18
+ editorApi?.core?.actions.requestDocument((doc) => {
19
+ // Use the document as you require
20
+ });
21
+ ```
22
+
23
+ See: Editor RFC 51 for more details.
24
+
25
+ - [#89840](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/89840) [`9f256dde75e9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9f256dde75e9) - [ux] Implement onClickCallback plugin option to editor-plugin-card, allowing a callback to be executed when a smartlink is clicked, used by CCFE for live view to open smartlinks on-click
26
+
27
+ ### Patch Changes
28
+
29
+ - [#91106](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/91106) [`b6ffa30186b9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b6ffa30186b9) - Bump ADF-schema package to version 35.0.0
30
+ - [#89296](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/89296) [`14a5e5877b97`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/14a5e5877b97) - [ux] [ED-22875] - Removed borders from multi-bodied extensions
31
+ - [#90878](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/90878) [`962275ee0910`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/962275ee0910) - [ux] [ED-22852] Update loom quick insert title, description and logo
32
+ - Updated dependencies
33
+
3
34
  ## 78.27.1
4
35
 
5
36
  ### Patch Changes
@@ -13,7 +13,7 @@ var commentMessages = exports.commentMessages = (0, _reactIntlNext.defineMessage
13
13
  },
14
14
  viewCommentsOnMedia: {
15
15
  id: 'fabric.editor.viewCommentOnMedia',
16
- defaultMessage: 'View comment',
16
+ defaultMessage: 'View comments',
17
17
  description: 'View a existing comment for this media (image/video)'
18
18
  },
19
19
  viewAndAddCommentsOnMedia: {
@@ -13,6 +13,7 @@ var _button = require("@atlaskit/button");
13
13
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
14
14
  var _comment = _interopRequireDefault(require("@atlaskit/icon/glyph/comment"));
15
15
  var _constants = require("@atlaskit/theme/constants");
16
+ var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
16
17
  var _media = require("../media");
17
18
  /** @jsx jsx */
18
19
 
@@ -36,15 +37,19 @@ var CommentBadge = exports.CommentBadge = function CommentBadge(_ref) {
36
37
  var intl = _ref.intl,
37
38
  width = _ref.width,
38
39
  height = _ref.height,
40
+ _ref$status = _ref.status,
41
+ status = _ref$status === void 0 ? 'default' : _ref$status,
39
42
  mediaElement = _ref.mediaElement,
40
43
  onClick = _ref.onClick,
44
+ onMouseEnter = _ref.onMouseEnter,
45
+ onMouseLeave = _ref.onMouseLeave,
41
46
  _ref$isEditor = _ref.isEditor,
42
47
  isEditor = _ref$isEditor === void 0 ? false : _ref$isEditor;
43
48
  var _useState = (0, _react.useState)(getBadgeSize(width, height)),
44
49
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
45
50
  badgeSize = _useState2[0],
46
51
  setBadgeSize = _useState2[1];
47
- var title = intl.formatMessage(_media.commentMessages.viewAndAddCommentsOnMedia);
52
+ var title = intl.formatMessage(_media.commentMessages.viewCommentsOnMedia);
48
53
  (0, _react.useEffect)(function () {
49
54
  var observer = new ResizeObserver((0, _debounce.default)(function (entries) {
50
55
  var _entries = (0, _slicedToArray2.default)(entries, 1),
@@ -62,21 +67,36 @@ var CommentBadge = exports.CommentBadge = function CommentBadge(_ref) {
62
67
  };
63
68
  }, [mediaElement]);
64
69
  var badgeDimensions = badgeSize === 'medium' ? '24px' : '16px';
70
+ var colourToken = (0, _react.useMemo)(function () {
71
+ switch (status) {
72
+ case 'active':
73
+ return "var(--ds-background-accent-yellow-subtlest-pressed, #F5CD47)";
74
+ case 'entered':
75
+ return "var(--ds-background-accent-yellow-subtlest-hovered, #F8E6A0)";
76
+ default:
77
+ return "var(--ds-background-accent-yellow-subtlest, #FFF7D6)";
78
+ }
79
+ }, [status]);
65
80
  return (0, _react2.jsx)("div", {
66
81
  css: isEditor ? [commentBadgeWrapper, commentBadgeEditorOverrides] : commentBadgeWrapper
82
+ }, (0, _react2.jsx)(_tooltip.default, {
83
+ position: "top",
84
+ content: title
67
85
  }, (0, _react2.jsx)(_button.CustomThemeButton, {
68
86
  style: {
69
87
  height: badgeDimensions,
70
88
  width: badgeDimensions,
71
- background: "var(--ds-background-accent-yellow-subtler, #F8E6A0)",
89
+ background: colourToken,
72
90
  display: 'flex',
73
91
  justifyContent: 'center',
74
92
  alignItems: 'center'
75
93
  },
76
94
  onClick: onClick,
95
+ onMouseEnter: onMouseEnter,
96
+ onMouseLeave: onMouseLeave,
77
97
  iconAfter: (0, _react2.jsx)(_comment.default, {
78
98
  label: title,
79
99
  size: badgeSize
80
100
  })
81
- }));
101
+ })));
82
102
  };
@@ -198,8 +198,8 @@ var toolbarInsertBlockMessages = exports.toolbarInsertBlockMessages = (0, _react
198
198
  },
199
199
  recordVideo: {
200
200
  id: 'fabric.editor.recordVideo',
201
- defaultMessage: 'Record video',
202
- description: 'Record video using Loom'
201
+ defaultMessage: 'Record a Loom video',
202
+ description: 'Record a Loom video'
203
203
  },
204
204
  addLoomVideo: {
205
205
  id: 'fabric.editor.addLoomVideo',
@@ -208,7 +208,7 @@ var toolbarInsertBlockMessages = exports.toolbarInsertBlockMessages = (0, _react
208
208
  },
209
209
  recordVideoDescription: {
210
210
  id: 'fabric.editor.recordVideo.description',
211
- defaultMessage: 'Record video using Loom',
212
- description: 'Record video using Loom'
211
+ defaultMessage: 'Record your screen and camera',
212
+ description: 'Record your screen and camera'
213
213
  }
214
214
  });
@@ -16,7 +16,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
16
16
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
17
17
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
18
18
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
19
- var packageVersion = "78.27.1";
19
+ var packageVersion = "78.28.0";
20
20
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
21
21
  // Remove URL as it has UGC
22
22
  // TODO: Sanitise the URL instead of just removing it
@@ -4,7 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.corePlugin = void 0;
7
- var _editorCommands = require("./editor-commands");
7
+ var _editorCommands = require("../editor-commands");
8
+ var _requestDocument = require("./requestDocument");
8
9
  /**
9
10
  * Core plugin that is always included in the preset.
10
11
  * Allows for executing `EditorCommand` and other core functionality.
@@ -41,6 +42,19 @@ var corePlugin = exports.corePlugin = function corePlugin(_ref) {
41
42
  }
42
43
  editorView.dom.blur();
43
44
  return true;
45
+ },
46
+ requestDocument: function requestDocument(onReceive, options) {
47
+ var _config$getEditorView;
48
+ var view = (_config$getEditorView = config === null || config === void 0 ? void 0 : config.getEditorView()) !== null && _config$getEditorView !== void 0 ? _config$getEditorView : null;
49
+ (0, _requestDocument.scheduleDocumentRequest)(view, onReceive, options === null || options === void 0 ? void 0 : options.transformer);
50
+ },
51
+ createTransformer: function createTransformer(cb) {
52
+ var _config$getEditorView2;
53
+ var view = (_config$getEditorView2 = config === null || config === void 0 ? void 0 : config.getEditorView()) !== null && _config$getEditorView2 !== void 0 ? _config$getEditorView2 : null;
54
+ if (!(view !== null && view !== void 0 && view.state.schema)) {
55
+ return undefined;
56
+ }
57
+ return cb(view === null || view === void 0 ? void 0 : view.state.schema);
44
58
  }
45
59
  }
46
60
  };
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.scheduleDocumentRequest = void 0;
8
+ exports.toJSON = toJSON;
9
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
10
+ var _editorJsonTransformer = require("@atlaskit/editor-json-transformer");
11
+ var _model = require("@atlaskit/editor-prosemirror/model");
12
+ var transformer = new _editorJsonTransformer.JSONTransformer();
13
+ function toJSON(node) {
14
+ return transformer.encode(node);
15
+ }
16
+
17
+ /**
18
+ * This throttles the callback with requestIdleCallback.
19
+ */
20
+ function createThrottleSchedule(callback) {
21
+ var frameId;
22
+ var lastArgs;
23
+ var wrapperFn = function wrapperFn() {
24
+ var _globalThis$requestId;
25
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
26
+ args[_key] = arguments[_key];
27
+ }
28
+ lastArgs = args;
29
+ if (frameId) {
30
+ return;
31
+ }
32
+
33
+ // If `requestIdleCallback` doesn't exist - fallback to `requestAnimationFrame`
34
+ var delayFunction = (_globalThis$requestId = globalThis.requestIdleCallback) !== null && _globalThis$requestId !== void 0 ? _globalThis$requestId : globalThis.requestAnimationFrame;
35
+ frameId = delayFunction(function () {
36
+ frameId = undefined;
37
+ if (lastArgs) {
38
+ callback.apply(void 0, (0, _toConsumableArray2.default)(lastArgs));
39
+ }
40
+ }, {
41
+ timeout: 100
42
+ });
43
+ };
44
+ return wrapperFn;
45
+ }
46
+ var scheduleDocumentRequest = exports.scheduleDocumentRequest = createThrottleSchedule(returnDocumentRequest);
47
+ function returnDocumentRequest(editorView, callback, transformer) {
48
+ var _editorView$state;
49
+ var _ref = (_editorView$state = editorView === null || editorView === void 0 ? void 0 : editorView.state) !== null && _editorView$state !== void 0 ? _editorView$state : {},
50
+ doc = _ref.doc,
51
+ schema = _ref.schema;
52
+ if (!doc || !schema) {
53
+ return undefined;
54
+ }
55
+ var json = toJSON(doc);
56
+ if (typeof transformer === 'undefined') {
57
+ callback(json);
58
+ } else {
59
+ var nodeSanitized = _model.Node.fromJSON(schema, json);
60
+ callback(transformer.encode(nodeSanitized));
61
+ }
62
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -22,7 +22,7 @@ var _templateObject, _templateObject2, _templateObject3;
22
22
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
23
23
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /** @jsx jsx */
24
24
  var packageName = "@atlaskit/editor-common";
25
- var packageVersion = "78.27.1";
25
+ var packageVersion = "78.28.0";
26
26
  var halfFocusRing = 1;
27
27
  var dropOffset = '0, 8';
28
28
  var DropList = /*#__PURE__*/function (_Component) {
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.sharedMultiBodiedExtensionStyles = exports.removeMarginsAndBorder = void 0;
7
7
  var _react = require("@emotion/react");
8
- var _colors = require("@atlaskit/theme/colors");
9
8
  /** @jsx jsx */
10
9
 
11
10
  // Wraps the navigation bar and extensionFrames
@@ -40,7 +39,6 @@ var mbeNavigation = (0, _react.css)({
40
39
  borderTopRightRadius: "var(--ds-border-radius, 3px)",
41
40
  userSelect: 'none',
42
41
  WebkitUserModify: 'read-only',
43
- border: "1px solid ".concat("var(--ds-border, ".concat(_colors.N40, ")")),
44
42
  borderBottom: 'none !important',
45
43
  background: "var(--ds-surface, white)",
46
44
  marginLeft: "var(--ds-space-100, 8px)",
@@ -55,7 +53,6 @@ var mbeNavigation = (0, _react.css)({
55
53
  });
56
54
  var extensionFrameContent = (0, _react.css)({
57
55
  padding: "var(--ds-space-100, 8px)".concat(" !important"),
58
- border: "1px solid ".concat("var(--ds-border, ".concat(_colors.N30, ")")),
59
56
  display: 'block',
60
57
  minHeight: '100px',
61
58
  background: "var(--ds-surface, white)",
@@ -7,7 +7,7 @@ export const 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,11 +1,12 @@
1
1
  /** @jsx jsx */
2
- import { useEffect, useState } from 'react';
2
+ import { useEffect, useMemo, useState } from 'react';
3
3
  import { css, jsx } from '@emotion/react';
4
4
  import debounce from 'lodash/debounce';
5
5
  import { CustomThemeButton } from '@atlaskit/button';
6
6
  import { akEditorUnitZIndex } from '@atlaskit/editor-shared-styles';
7
7
  import CommentIcon from '@atlaskit/icon/glyph/comment';
8
8
  import { layers } from '@atlaskit/theme/constants';
9
+ import Tooltip from '@atlaskit/tooltip';
9
10
  import { commentMessages as messages } from '../media';
10
11
  const commentBadgeWrapper = css({
11
12
  position: 'absolute',
@@ -27,12 +28,15 @@ export const CommentBadge = ({
27
28
  intl,
28
29
  width,
29
30
  height,
31
+ status = 'default',
30
32
  mediaElement,
31
33
  onClick,
34
+ onMouseEnter,
35
+ onMouseLeave,
32
36
  isEditor = false
33
37
  }) => {
34
38
  const [badgeSize, setBadgeSize] = useState(getBadgeSize(width, height));
35
- const title = intl.formatMessage(messages.viewAndAddCommentsOnMedia);
39
+ const title = intl.formatMessage(messages.viewCommentsOnMedia);
36
40
  useEffect(() => {
37
41
  const observer = new ResizeObserver(debounce(entries => {
38
42
  const [entry] = entries;
@@ -50,21 +54,36 @@ export const CommentBadge = ({
50
54
  };
51
55
  }, [mediaElement]);
52
56
  const badgeDimensions = badgeSize === 'medium' ? '24px' : '16px';
57
+ const colourToken = useMemo(() => {
58
+ switch (status) {
59
+ case 'active':
60
+ return "var(--ds-background-accent-yellow-subtlest-pressed, #F5CD47)";
61
+ case 'entered':
62
+ return "var(--ds-background-accent-yellow-subtlest-hovered, #F8E6A0)";
63
+ default:
64
+ return "var(--ds-background-accent-yellow-subtlest, #FFF7D6)";
65
+ }
66
+ }, [status]);
53
67
  return jsx("div", {
54
68
  css: isEditor ? [commentBadgeWrapper, commentBadgeEditorOverrides] : commentBadgeWrapper
69
+ }, jsx(Tooltip, {
70
+ position: "top",
71
+ content: title
55
72
  }, jsx(CustomThemeButton, {
56
73
  style: {
57
74
  height: badgeDimensions,
58
75
  width: badgeDimensions,
59
- background: "var(--ds-background-accent-yellow-subtler, #F8E6A0)",
76
+ background: colourToken,
60
77
  display: 'flex',
61
78
  justifyContent: 'center',
62
79
  alignItems: 'center'
63
80
  },
64
81
  onClick: onClick,
82
+ onMouseEnter: onMouseEnter,
83
+ onMouseLeave: onMouseLeave,
65
84
  iconAfter: jsx(CommentIcon, {
66
85
  label: title,
67
86
  size: badgeSize
68
87
  })
69
- }));
88
+ })));
70
89
  };
@@ -192,8 +192,8 @@ export const 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 const 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
  });
@@ -1,6 +1,6 @@
1
1
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
2
2
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
3
- const packageVersion = "78.27.1";
3
+ const packageVersion = "78.28.0";
4
4
  const sanitiseSentryEvents = (data, _hint) => {
5
5
  // Remove URL as it has UGC
6
6
  // 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.
@@ -38,6 +39,19 @@ export const corePlugin = ({
38
39
  }
39
40
  editorView.dom.blur();
40
41
  return true;
42
+ },
43
+ requestDocument(onReceive, options) {
44
+ var _config$getEditorView;
45
+ const view = (_config$getEditorView = config === null || config === void 0 ? void 0 : config.getEditorView()) !== null && _config$getEditorView !== void 0 ? _config$getEditorView : null;
46
+ scheduleDocumentRequest(view, onReceive, options === null || options === void 0 ? void 0 : options.transformer);
47
+ },
48
+ createTransformer(cb) {
49
+ var _config$getEditorView2;
50
+ const view = (_config$getEditorView2 = config === null || config === void 0 ? void 0 : config.getEditorView()) !== null && _config$getEditorView2 !== void 0 ? _config$getEditorView2 : null;
51
+ if (!(view !== null && view !== void 0 && view.state.schema)) {
52
+ return undefined;
53
+ }
54
+ return cb(view === null || view === void 0 ? void 0 : view.state.schema);
41
55
  }
42
56
  }
43
57
  };
@@ -0,0 +1,51 @@
1
+ import { JSONTransformer } from '@atlaskit/editor-json-transformer';
2
+ import { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
3
+ const transformer = new JSONTransformer();
4
+ export function toJSON(node) {
5
+ return transformer.encode(node);
6
+ }
7
+
8
+ /**
9
+ * This throttles the callback with requestIdleCallback.
10
+ */
11
+ function createThrottleSchedule(callback) {
12
+ let frameId;
13
+ let lastArgs;
14
+ const wrapperFn = (...args) => {
15
+ var _globalThis$requestId;
16
+ lastArgs = args;
17
+ if (frameId) {
18
+ return;
19
+ }
20
+
21
+ // If `requestIdleCallback` doesn't exist - fallback to `requestAnimationFrame`
22
+ const delayFunction = (_globalThis$requestId = globalThis.requestIdleCallback) !== null && _globalThis$requestId !== void 0 ? _globalThis$requestId : globalThis.requestAnimationFrame;
23
+ frameId = delayFunction(() => {
24
+ frameId = undefined;
25
+ if (lastArgs) {
26
+ callback(...lastArgs);
27
+ }
28
+ }, {
29
+ timeout: 100
30
+ });
31
+ };
32
+ return wrapperFn;
33
+ }
34
+ export const scheduleDocumentRequest = createThrottleSchedule(returnDocumentRequest);
35
+ function returnDocumentRequest(editorView, callback, transformer) {
36
+ var _editorView$state;
37
+ const {
38
+ doc,
39
+ schema
40
+ } = (_editorView$state = editorView === null || editorView === void 0 ? void 0 : editorView.state) !== null && _editorView$state !== void 0 ? _editorView$state : {};
41
+ if (!doc || !schema) {
42
+ return undefined;
43
+ }
44
+ const json = toJSON(doc);
45
+ if (typeof transformer === 'undefined') {
46
+ callback(json);
47
+ } else {
48
+ const nodeSanitized = PMNode.fromJSON(schema, json);
49
+ callback(transformer.encode(nodeSanitized));
50
+ }
51
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -7,7 +7,7 @@ import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@
7
7
  import { N0, N50A, N60A, N900 } from '@atlaskit/theme/colors';
8
8
  import Layer from '../Layer';
9
9
  const packageName = "@atlaskit/editor-common";
10
- const packageVersion = "78.27.1";
10
+ const packageVersion = "78.28.0";
11
11
  const halfFocusRing = 1;
12
12
  const dropOffset = '0, 8';
13
13
  class DropList extends 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
  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)",
@@ -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.0";
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.0";
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,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';
@@ -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,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';
@@ -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;
@@ -40,8 +40,8 @@ export declare class EditorPluginInjectionAPI implements PluginInjectionAPIDefin
40
40
  private plugins;
41
41
  constructor({ getEditorState, getEditorView }: PluginInjectionAPIProps);
42
42
  api<T extends NextEditorPlugin<any, any>>(): import("../types/next-editor-plugin").PublicPluginAPI<[
43
- 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>,
44
- ..."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> : [
43
+ 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>,
44
+ ..."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> : [
45
45
  ] : [
46
46
  ]
47
47
  ]>;
@@ -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;
@@ -103,7 +103,7 @@ export type PluginDependenciesAPI<Plugin extends NextEditorPlugin<any, any>> = {
103
103
  commands: Plugin extends NextEditorPlugin<any, infer Metadata> ? ExtractCommandsFromMetadata<Metadata> : never;
104
104
  };
105
105
  export type CreatePluginDependenciesAPI<PluginList extends NextEditorPlugin<any, any>[]> = {
106
- [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;
106
+ [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;
107
107
  };
108
108
  export type PluginWithConfiguration<Plugin> = undefined extends ExtractPluginConfiguration<Plugin> ? [
109
109
  Plugin,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "78.27.1",
3
+ "version": "78.28.0",
4
4
  "description": "A package that contains common classes and components for editor and renderer",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -94,7 +94,7 @@
94
94
  },
95
95
  "dependencies": {
96
96
  "@atlaskit/activity-provider": "^2.4.0",
97
- "@atlaskit/adf-schema": "^35.8.0",
97
+ "@atlaskit/adf-schema": "^35.9.0",
98
98
  "@atlaskit/adf-utils": "^19.0.0",
99
99
  "@atlaskit/analytics-listeners": "^8.9.0",
100
100
  "@atlaskit/analytics-namespaced-context": "^6.9.0",
@@ -103,7 +103,7 @@
103
103
  "@atlaskit/button": "^17.12.0",
104
104
  "@atlaskit/code": "^15.1.0",
105
105
  "@atlaskit/codemod-utils": "^4.2.0",
106
- "@atlaskit/custom-steps": "^0.0.17",
106
+ "@atlaskit/custom-steps": "^0.0.18",
107
107
  "@atlaskit/editor-json-transformer": "^8.10.0",
108
108
  "@atlaskit/editor-palette": "1.5.3",
109
109
  "@atlaskit/editor-prosemirror": "3.0.0",
@@ -129,7 +129,7 @@
129
129
  "@atlaskit/primitives": "^5.5.0",
130
130
  "@atlaskit/profilecard": "^19.11.0",
131
131
  "@atlaskit/section-message": "^6.4.0",
132
- "@atlaskit/smart-card": "^26.55.0",
132
+ "@atlaskit/smart-card": "^26.56.0",
133
133
  "@atlaskit/smart-user-picker": "^6.9.0",
134
134
  "@atlaskit/spinner": "^16.0.0",
135
135
  "@atlaskit/task-decision": "^17.9.0",
@@ -1,39 +0,0 @@
1
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
2
- import type { EditorCommand, NextEditorPlugin } from '../types';
3
- export type CorePlugin = NextEditorPlugin<'core', {
4
- pluginConfiguration: {
5
- getEditorView: () => EditorView | undefined;
6
- };
7
- actions: {
8
- /**
9
- * Dispatches an EditorCommand to ProseMirror
10
- *
11
- * @param command A function (EditorCommand | undefined) that takes an object containing a `Transaction` and returns a `Transaction` if it
12
- * is successful or `null` if it shouldn't be dispatched.
13
- * @returns (boolean) if the command was successful in dispatching
14
- */
15
- execute: (command: EditorCommand | undefined) => boolean;
16
- /**
17
- * Focuses the editor.
18
- *
19
- * Calls the focus method of the `EditorView` and scrolls the
20
- * current selection into view.
21
- *
22
- * @returns (boolean) if the focus was successful
23
- */
24
- focus: () => boolean;
25
- /**
26
- * Blurs the editor.
27
- *
28
- * Calls blur on the editor DOM element.
29
- *
30
- * @returns (boolean) if the blur was successful
31
- */
32
- blur: () => boolean;
33
- };
34
- }>;
35
- /**
36
- * Core plugin that is always included in the preset.
37
- * Allows for executing `EditorCommand` and other core functionality.
38
- */
39
- export declare const corePlugin: CorePlugin;
@@ -1,39 +0,0 @@
1
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
2
- import type { EditorCommand, NextEditorPlugin } from '../types';
3
- export type CorePlugin = NextEditorPlugin<'core', {
4
- pluginConfiguration: {
5
- getEditorView: () => EditorView | undefined;
6
- };
7
- actions: {
8
- /**
9
- * Dispatches an EditorCommand to ProseMirror
10
- *
11
- * @param command A function (EditorCommand | undefined) that takes an object containing a `Transaction` and returns a `Transaction` if it
12
- * is successful or `null` if it shouldn't be dispatched.
13
- * @returns (boolean) if the command was successful in dispatching
14
- */
15
- execute: (command: EditorCommand | undefined) => boolean;
16
- /**
17
- * Focuses the editor.
18
- *
19
- * Calls the focus method of the `EditorView` and scrolls the
20
- * current selection into view.
21
- *
22
- * @returns (boolean) if the focus was successful
23
- */
24
- focus: () => boolean;
25
- /**
26
- * Blurs the editor.
27
- *
28
- * Calls blur on the editor DOM element.
29
- *
30
- * @returns (boolean) if the blur was successful
31
- */
32
- blur: () => boolean;
33
- };
34
- }>;
35
- /**
36
- * Core plugin that is always included in the preset.
37
- * Allows for executing `EditorCommand` and other core functionality.
38
- */
39
- export declare const corePlugin: CorePlugin;