@atlaskit/editor-common 78.23.6 → 78.23.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/cjs/guideline/fixedGuideline.js +5 -5
- package/dist/cjs/media/messages/comments.js +5 -0
- package/dist/cjs/media-single/CommentBadge.js +74 -0
- package/dist/cjs/media-single/index.js +8 -1
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/styles/shared/annotation.js +1 -1
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/es2019/guideline/fixedGuideline.js +6 -5
- package/dist/es2019/media/messages/comments.js +5 -0
- package/dist/es2019/media-single/CommentBadge.js +63 -0
- package/dist/es2019/media-single/index.js +2 -1
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/styles/shared/annotation.js +1 -1
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/esm/guideline/fixedGuideline.js +5 -5
- package/dist/esm/media/messages/comments.js +5 -0
- package/dist/esm/media-single/CommentBadge.js +66 -0
- package/dist/esm/media-single/index.js +2 -1
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/styles/shared/annotation.js +1 -1
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/types/guideline/fixedGuideline.d.ts +2 -2
- package/dist/types/media/messages/comments.d.ts +5 -0
- package/dist/types/media-single/CommentBadge.d.ts +13 -0
- package/dist/types/media-single/index.d.ts +1 -0
- package/dist/types-ts4.5/guideline/fixedGuideline.d.ts +2 -2
- package/dist/types-ts4.5/media/messages/comments.d.ts +5 -0
- package/dist/types-ts4.5/media-single/CommentBadge.d.ts +13 -0
- package/dist/types-ts4.5/media-single/index.d.ts +1 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 78.23.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#88096](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/88096) [`38f5046368e5`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/38f5046368e5) - fix preserve table width undo / redo issue and show full width guide on small screens
|
|
8
|
+
- [#87596](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/87596) [`e0b95c3a4fba`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/e0b95c3a4fba) - Add new UI badge for media node to trigger comments
|
|
9
|
+
|
|
10
|
+
## 78.23.7
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [#87820](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/87820) [`6702a9cc8f80`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6702a9cc8f80) - [ux] [ED-22819] Update comment styling for media in renderer so that it aligns with editor
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 78.23.6
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -28,8 +28,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
28
28
|
* @returns A collection of LengthGuide objects which can be used to draw left & right guides
|
|
29
29
|
*/
|
|
30
30
|
var createGuidesFromLengths = exports.createGuidesFromLengths = function createGuidesFromLengths(lengths) {
|
|
31
|
-
var
|
|
32
|
-
return Array.from(new Set(lengths)).reduce(function (acc, length) {
|
|
31
|
+
var hasFullWidthGuide = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
32
|
+
return Array.from(new Set(lengths)).reduce(function (acc, length, index) {
|
|
33
33
|
var h = length * 0.5;
|
|
34
34
|
if (length === 0) {
|
|
35
35
|
return [].concat((0, _toConsumableArray2.default)(acc), [{
|
|
@@ -46,7 +46,7 @@ var createGuidesFromLengths = exports.createGuidesFromLengths = function createG
|
|
|
46
46
|
left: -h,
|
|
47
47
|
right: h,
|
|
48
48
|
length: length
|
|
49
|
-
},
|
|
49
|
+
}, hasFullWidthGuide && index === lengths.length - 1 ? {
|
|
50
50
|
isFullWidth: true
|
|
51
51
|
} : {})]);
|
|
52
52
|
}, []);
|
|
@@ -60,8 +60,8 @@ var createGuidesFromLengths = exports.createGuidesFromLengths = function createG
|
|
|
60
60
|
*/
|
|
61
61
|
var createFixedGuidelinesFromLengths = exports.createFixedGuidelinesFromLengths = function createFixedGuidelinesFromLengths(lengths) {
|
|
62
62
|
var key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'guide';
|
|
63
|
-
var
|
|
64
|
-
return createGuidesFromLengths(lengths,
|
|
63
|
+
var hasFullWidthGuide = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
64
|
+
return createGuidesFromLengths(lengths, hasFullWidthGuide).reduce(function (acc, _ref) {
|
|
65
65
|
var left = _ref.left,
|
|
66
66
|
right = _ref.right,
|
|
67
67
|
length = _ref.length,
|
|
@@ -10,5 +10,10 @@ var commentMessages = exports.commentMessages = (0, _reactIntlNext.defineMessage
|
|
|
10
10
|
id: 'fabric.editor.addCommentOnMedia',
|
|
11
11
|
defaultMessage: 'Add comment',
|
|
12
12
|
description: 'Add a comment for this image'
|
|
13
|
+
},
|
|
14
|
+
viewAndAddCommentsOnMedia: {
|
|
15
|
+
id: 'fabric.editor.viewAndAddCommentsOnMedia',
|
|
16
|
+
defaultMessage: 'View and add comments',
|
|
17
|
+
description: 'View and add comments for this image'
|
|
13
18
|
}
|
|
14
19
|
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.CommentBadge = void 0;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
+
var _react = require("react");
|
|
10
|
+
var _react2 = require("@emotion/react");
|
|
11
|
+
var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
12
|
+
var _button = require("@atlaskit/button");
|
|
13
|
+
var _comment = _interopRequireDefault(require("@atlaskit/icon/glyph/comment"));
|
|
14
|
+
var _constants = require("@atlaskit/theme/constants");
|
|
15
|
+
var _media = require("../media");
|
|
16
|
+
/** @jsx jsx */
|
|
17
|
+
|
|
18
|
+
var commentBadgeWrapper = (0, _react2.css)({
|
|
19
|
+
position: 'absolute',
|
|
20
|
+
// closest parent element with position relative is .resizer-hover-zone, which includes 10px padding
|
|
21
|
+
right: '14px',
|
|
22
|
+
top: '2px',
|
|
23
|
+
borderRadius: '3px',
|
|
24
|
+
zIndex: _constants.layers.card()
|
|
25
|
+
});
|
|
26
|
+
var getDefaultSize = function getDefaultSize(node) {
|
|
27
|
+
// width is the original width of image, not resized or currently rendered to user. Defaulting to medium for now
|
|
28
|
+
return !node || node.attrs.width > 70 ? 'medium' : 'small';
|
|
29
|
+
};
|
|
30
|
+
var CommentBadge = exports.CommentBadge = function CommentBadge(_ref) {
|
|
31
|
+
var intl = _ref.intl,
|
|
32
|
+
mediaNode = _ref.mediaNode,
|
|
33
|
+
mediaElement = _ref.mediaElement,
|
|
34
|
+
onClick = _ref.onClick;
|
|
35
|
+
var _useState = (0, _react.useState)(getDefaultSize(mediaNode)),
|
|
36
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
37
|
+
badgeSize = _useState2[0],
|
|
38
|
+
setBadgeSize = _useState2[1];
|
|
39
|
+
var title = intl.formatMessage(_media.commentMessages.viewAndAddCommentsOnMedia);
|
|
40
|
+
(0, _react.useEffect)(function () {
|
|
41
|
+
var observer = new ResizeObserver((0, _debounce.default)(function (entries) {
|
|
42
|
+
var _entries = (0, _slicedToArray2.default)(entries, 1),
|
|
43
|
+
entry = _entries[0];
|
|
44
|
+
var _entry$contentRect = entry.contentRect,
|
|
45
|
+
width = _entry$contentRect.width,
|
|
46
|
+
height = _entry$contentRect.height;
|
|
47
|
+
setBadgeSize(width > 70 || height > 70 ? 'medium' : 'small');
|
|
48
|
+
}));
|
|
49
|
+
if (mediaElement) {
|
|
50
|
+
observer.observe(mediaElement);
|
|
51
|
+
}
|
|
52
|
+
return function () {
|
|
53
|
+
observer.disconnect();
|
|
54
|
+
};
|
|
55
|
+
}, [mediaElement]);
|
|
56
|
+
var badgeDimensions = badgeSize === 'medium' ? '24px' : '16px';
|
|
57
|
+
return (0, _react2.jsx)("div", {
|
|
58
|
+
css: commentBadgeWrapper
|
|
59
|
+
}, (0, _react2.jsx)(_button.CustomThemeButton, {
|
|
60
|
+
style: {
|
|
61
|
+
height: badgeDimensions,
|
|
62
|
+
width: badgeDimensions,
|
|
63
|
+
background: "var(--ds-background-accent-yellow-subtler, #F8E6A0)",
|
|
64
|
+
display: 'flex',
|
|
65
|
+
justifyContent: 'center',
|
|
66
|
+
alignItems: 'center'
|
|
67
|
+
},
|
|
68
|
+
onClick: onClick,
|
|
69
|
+
iconAfter: (0, _react2.jsx)(_comment.default, {
|
|
70
|
+
label: title,
|
|
71
|
+
size: badgeSize
|
|
72
|
+
})
|
|
73
|
+
}));
|
|
74
|
+
};
|
|
@@ -9,6 +9,12 @@ Object.defineProperty(exports, "CAPTION_PLACEHOLDER_ID", {
|
|
|
9
9
|
return _constants.CAPTION_PLACEHOLDER_ID;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
+
Object.defineProperty(exports, "CommentBadge", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _CommentBadge.CommentBadge;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
12
18
|
Object.defineProperty(exports, "DEFAULT_IMAGE_HEIGHT", {
|
|
13
19
|
enumerable: true,
|
|
14
20
|
get: function get() {
|
|
@@ -130,4 +136,5 @@ Object.defineProperty(exports, "wrappedLayouts", {
|
|
|
130
136
|
}
|
|
131
137
|
});
|
|
132
138
|
var _constants = require("./constants");
|
|
133
|
-
var _utils = require("./utils");
|
|
139
|
+
var _utils = require("./utils");
|
|
140
|
+
var _CommentBadge = require("./CommentBadge");
|
|
@@ -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.23.
|
|
19
|
+
var packageVersion = "78.23.8";
|
|
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
|
|
@@ -76,6 +76,6 @@ var annotationSharedStyles = exports.annotationSharedStyles = function annotatio
|
|
|
76
76
|
return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n .", " {\n ", ";\n }\n\n .", " {\n ", ";\n cursor: initial;\n }\n\n .", " {\n ", ";\n }\n\n // Styling for comments on media node\n .", "[class*=ak-editor-block-annotation-] {\n border-radius: 3px;\n }\n\n .", ".", " {\n box-shadow: ", ";\n }\n\n .", ".", " {\n box-shadow: ", ";\n }\n\n .", ".", " {\n box-shadow: ", ";\n }\n }\n"])), AnnotationSharedClassNames.focus, AnnotationSharedCSSByState().focus, AnnotationSharedClassNames.draft, AnnotationSharedCSSByState().focus, AnnotationSharedClassNames.blur, AnnotationSharedCSSByState().blur, mediaNodeDomRef, mediaNodeDomRef, BlockAnnotationSharedClassNames.draft, (0, _styles.commentStatusStyleMap)('draft'), mediaNodeDomRef, BlockAnnotationSharedClassNames.focus, (0, _styles.commentStatusStyleMap)('focus'), mediaNodeDomRef, BlockAnnotationSharedClassNames.blur, (0, _styles.commentStatusStyleMap)('blur'));
|
|
77
77
|
};
|
|
78
78
|
var mediaAnnotationStyles = exports.mediaAnnotationStyles = (0, _react.css)({
|
|
79
|
-
boxShadow: "
|
|
79
|
+
boxShadow: "3px 3px ".concat("var(--ds-background-accent-yellow-subtler, ".concat(Y75a, ")")),
|
|
80
80
|
borderRadius: '3px'
|
|
81
81
|
});
|
|
@@ -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.23.
|
|
25
|
+
var packageVersion = "78.23.8";
|
|
26
26
|
var halfFocusRing = 1;
|
|
27
27
|
var dropOffset = '0, 8';
|
|
28
28
|
var DropList = /*#__PURE__*/function (_Component) {
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
* @param lengths A colection of length values which will be split into a left & right guides.
|
|
17
17
|
* @returns A collection of LengthGuide objects which can be used to draw left & right guides
|
|
18
18
|
*/
|
|
19
|
-
export const createGuidesFromLengths = (lengths,
|
|
20
|
-
return Array.from(new Set(lengths)).reduce((acc, length) => {
|
|
19
|
+
export const createGuidesFromLengths = (lengths, hasFullWidthGuide = false) => {
|
|
20
|
+
return Array.from(new Set(lengths)).reduce((acc, length, index) => {
|
|
21
21
|
const h = length * 0.5;
|
|
22
22
|
if (length === 0) {
|
|
23
23
|
return [...acc, {
|
|
@@ -34,7 +34,8 @@ export const createGuidesFromLengths = (lengths, isMaxLengthFullWidth = false) =
|
|
|
34
34
|
left: -h,
|
|
35
35
|
right: h,
|
|
36
36
|
length,
|
|
37
|
-
|
|
37
|
+
// Assumes the full width guide is always the last length in the array
|
|
38
|
+
...(hasFullWidthGuide && index === lengths.length - 1 ? {
|
|
38
39
|
isFullWidth: true
|
|
39
40
|
} : {})
|
|
40
41
|
}];
|
|
@@ -47,8 +48,8 @@ export const createGuidesFromLengths = (lengths, isMaxLengthFullWidth = false) =
|
|
|
47
48
|
* When length is 0, generate a guideline at position: {x: 0}
|
|
48
49
|
*
|
|
49
50
|
*/
|
|
50
|
-
export const createFixedGuidelinesFromLengths = (lengths, key = 'guide',
|
|
51
|
-
return createGuidesFromLengths(lengths,
|
|
51
|
+
export const createFixedGuidelinesFromLengths = (lengths, key = 'guide', hasFullWidthGuide = false) => {
|
|
52
|
+
return createGuidesFromLengths(lengths, hasFullWidthGuide).reduce((acc, {
|
|
52
53
|
left,
|
|
53
54
|
right,
|
|
54
55
|
length,
|
|
@@ -4,5 +4,10 @@ export const commentMessages = defineMessages({
|
|
|
4
4
|
id: 'fabric.editor.addCommentOnMedia',
|
|
5
5
|
defaultMessage: 'Add comment',
|
|
6
6
|
description: 'Add a comment for this image'
|
|
7
|
+
},
|
|
8
|
+
viewAndAddCommentsOnMedia: {
|
|
9
|
+
id: 'fabric.editor.viewAndAddCommentsOnMedia',
|
|
10
|
+
defaultMessage: 'View and add comments',
|
|
11
|
+
description: 'View and add comments for this image'
|
|
7
12
|
}
|
|
8
13
|
});
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { css, jsx } from '@emotion/react';
|
|
4
|
+
import debounce from 'lodash/debounce';
|
|
5
|
+
import { CustomThemeButton } from '@atlaskit/button';
|
|
6
|
+
import CommentIcon from '@atlaskit/icon/glyph/comment';
|
|
7
|
+
import { layers } from '@atlaskit/theme/constants';
|
|
8
|
+
import { commentMessages as messages } from '../media';
|
|
9
|
+
const commentBadgeWrapper = css({
|
|
10
|
+
position: 'absolute',
|
|
11
|
+
// closest parent element with position relative is .resizer-hover-zone, which includes 10px padding
|
|
12
|
+
right: '14px',
|
|
13
|
+
top: '2px',
|
|
14
|
+
borderRadius: '3px',
|
|
15
|
+
zIndex: layers.card()
|
|
16
|
+
});
|
|
17
|
+
const getDefaultSize = node => {
|
|
18
|
+
// width is the original width of image, not resized or currently rendered to user. Defaulting to medium for now
|
|
19
|
+
return !node || node.attrs.width > 70 ? 'medium' : 'small';
|
|
20
|
+
};
|
|
21
|
+
export const CommentBadge = ({
|
|
22
|
+
intl,
|
|
23
|
+
mediaNode,
|
|
24
|
+
mediaElement,
|
|
25
|
+
onClick
|
|
26
|
+
}) => {
|
|
27
|
+
const [badgeSize, setBadgeSize] = useState(getDefaultSize(mediaNode));
|
|
28
|
+
const title = intl.formatMessage(messages.viewAndAddCommentsOnMedia);
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
const observer = new ResizeObserver(debounce(entries => {
|
|
31
|
+
const [entry] = entries;
|
|
32
|
+
const {
|
|
33
|
+
width,
|
|
34
|
+
height
|
|
35
|
+
} = entry.contentRect;
|
|
36
|
+
setBadgeSize(width > 70 || height > 70 ? 'medium' : 'small');
|
|
37
|
+
}));
|
|
38
|
+
if (mediaElement) {
|
|
39
|
+
observer.observe(mediaElement);
|
|
40
|
+
}
|
|
41
|
+
return () => {
|
|
42
|
+
observer.disconnect();
|
|
43
|
+
};
|
|
44
|
+
}, [mediaElement]);
|
|
45
|
+
const badgeDimensions = badgeSize === 'medium' ? '24px' : '16px';
|
|
46
|
+
return jsx("div", {
|
|
47
|
+
css: commentBadgeWrapper
|
|
48
|
+
}, jsx(CustomThemeButton, {
|
|
49
|
+
style: {
|
|
50
|
+
height: badgeDimensions,
|
|
51
|
+
width: badgeDimensions,
|
|
52
|
+
background: "var(--ds-background-accent-yellow-subtler, #F8E6A0)",
|
|
53
|
+
display: 'flex',
|
|
54
|
+
justifyContent: 'center',
|
|
55
|
+
alignItems: 'center'
|
|
56
|
+
},
|
|
57
|
+
onClick: onClick,
|
|
58
|
+
iconAfter: jsx(CommentIcon, {
|
|
59
|
+
label: title,
|
|
60
|
+
size: badgeSize
|
|
61
|
+
})
|
|
62
|
+
}));
|
|
63
|
+
};
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export { MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH, MEDIA_SINGLE_VIDEO_MIN_PIXEL_WIDTH, MEDIA_SINGLE_SNAP_GAP, MEDIA_SINGLE_HIGHLIGHT_GAP, MEDIA_SINGLE_GUTTER_SIZE, MEDIA_SINGLE_RESIZE_THROTTLE_TIME, Layout as MediaSingleLayout, DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, wrappedLayouts, CAPTION_PLACEHOLDER_ID } from './constants';
|
|
2
|
-
export { getMediaSinglePixelWidth, calcMediaSinglePixelWidth, calcMediaSingleMaxWidth, getMediaSingleInitialWidth, calculateOffsetLeft, roundToNearest, calcMinWidth, getMaxWidthForNestedNode, getMaxWidthForNestedNodeNext, currentMediaNodeWithPos } from './utils';
|
|
2
|
+
export { getMediaSinglePixelWidth, calcMediaSinglePixelWidth, calcMediaSingleMaxWidth, getMediaSingleInitialWidth, calculateOffsetLeft, roundToNearest, calcMinWidth, getMaxWidthForNestedNode, getMaxWidthForNestedNodeNext, currentMediaNodeWithPos } from './utils';
|
|
3
|
+
export { CommentBadge } from './CommentBadge';
|
|
@@ -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.23.
|
|
3
|
+
const packageVersion = "78.23.8";
|
|
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
|
|
@@ -95,6 +95,6 @@ export const annotationSharedStyles = () => css`
|
|
|
95
95
|
}
|
|
96
96
|
`;
|
|
97
97
|
export const mediaAnnotationStyles = css({
|
|
98
|
-
boxShadow: `
|
|
98
|
+
boxShadow: `3px 3px ${`var(--ds-background-accent-yellow-subtler, ${Y75a})`}`,
|
|
99
99
|
borderRadius: '3px'
|
|
100
100
|
});
|
|
@@ -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.23.
|
|
10
|
+
const packageVersion = "78.23.8";
|
|
11
11
|
const halfFocusRing = 1;
|
|
12
12
|
const dropOffset = '0, 8';
|
|
13
13
|
class DropList extends Component {
|
|
@@ -21,8 +21,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
21
21
|
* @returns A collection of LengthGuide objects which can be used to draw left & right guides
|
|
22
22
|
*/
|
|
23
23
|
export var createGuidesFromLengths = function createGuidesFromLengths(lengths) {
|
|
24
|
-
var
|
|
25
|
-
return Array.from(new Set(lengths)).reduce(function (acc, length) {
|
|
24
|
+
var hasFullWidthGuide = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
25
|
+
return Array.from(new Set(lengths)).reduce(function (acc, length, index) {
|
|
26
26
|
var h = length * 0.5;
|
|
27
27
|
if (length === 0) {
|
|
28
28
|
return [].concat(_toConsumableArray(acc), [{
|
|
@@ -39,7 +39,7 @@ export var createGuidesFromLengths = function createGuidesFromLengths(lengths) {
|
|
|
39
39
|
left: -h,
|
|
40
40
|
right: h,
|
|
41
41
|
length: length
|
|
42
|
-
},
|
|
42
|
+
}, hasFullWidthGuide && index === lengths.length - 1 ? {
|
|
43
43
|
isFullWidth: true
|
|
44
44
|
} : {})]);
|
|
45
45
|
}, []);
|
|
@@ -53,8 +53,8 @@ export var createGuidesFromLengths = function createGuidesFromLengths(lengths) {
|
|
|
53
53
|
*/
|
|
54
54
|
export var createFixedGuidelinesFromLengths = function createFixedGuidelinesFromLengths(lengths) {
|
|
55
55
|
var key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'guide';
|
|
56
|
-
var
|
|
57
|
-
return createGuidesFromLengths(lengths,
|
|
56
|
+
var hasFullWidthGuide = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
57
|
+
return createGuidesFromLengths(lengths, hasFullWidthGuide).reduce(function (acc, _ref) {
|
|
58
58
|
var left = _ref.left,
|
|
59
59
|
right = _ref.right,
|
|
60
60
|
length = _ref.length,
|
|
@@ -4,5 +4,10 @@ export var commentMessages = defineMessages({
|
|
|
4
4
|
id: 'fabric.editor.addCommentOnMedia',
|
|
5
5
|
defaultMessage: 'Add comment',
|
|
6
6
|
description: 'Add a comment for this image'
|
|
7
|
+
},
|
|
8
|
+
viewAndAddCommentsOnMedia: {
|
|
9
|
+
id: 'fabric.editor.viewAndAddCommentsOnMedia',
|
|
10
|
+
defaultMessage: 'View and add comments',
|
|
11
|
+
description: 'View and add comments for this image'
|
|
7
12
|
}
|
|
8
13
|
});
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
/** @jsx jsx */
|
|
3
|
+
import { useEffect, useState } from 'react';
|
|
4
|
+
import { css, jsx } from '@emotion/react';
|
|
5
|
+
import debounce from 'lodash/debounce';
|
|
6
|
+
import { CustomThemeButton } from '@atlaskit/button';
|
|
7
|
+
import CommentIcon from '@atlaskit/icon/glyph/comment';
|
|
8
|
+
import { layers } from '@atlaskit/theme/constants';
|
|
9
|
+
import { commentMessages as messages } from '../media';
|
|
10
|
+
var commentBadgeWrapper = css({
|
|
11
|
+
position: 'absolute',
|
|
12
|
+
// closest parent element with position relative is .resizer-hover-zone, which includes 10px padding
|
|
13
|
+
right: '14px',
|
|
14
|
+
top: '2px',
|
|
15
|
+
borderRadius: '3px',
|
|
16
|
+
zIndex: layers.card()
|
|
17
|
+
});
|
|
18
|
+
var getDefaultSize = function getDefaultSize(node) {
|
|
19
|
+
// width is the original width of image, not resized or currently rendered to user. Defaulting to medium for now
|
|
20
|
+
return !node || node.attrs.width > 70 ? 'medium' : 'small';
|
|
21
|
+
};
|
|
22
|
+
export var CommentBadge = function CommentBadge(_ref) {
|
|
23
|
+
var intl = _ref.intl,
|
|
24
|
+
mediaNode = _ref.mediaNode,
|
|
25
|
+
mediaElement = _ref.mediaElement,
|
|
26
|
+
onClick = _ref.onClick;
|
|
27
|
+
var _useState = useState(getDefaultSize(mediaNode)),
|
|
28
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
29
|
+
badgeSize = _useState2[0],
|
|
30
|
+
setBadgeSize = _useState2[1];
|
|
31
|
+
var title = intl.formatMessage(messages.viewAndAddCommentsOnMedia);
|
|
32
|
+
useEffect(function () {
|
|
33
|
+
var observer = new ResizeObserver(debounce(function (entries) {
|
|
34
|
+
var _entries = _slicedToArray(entries, 1),
|
|
35
|
+
entry = _entries[0];
|
|
36
|
+
var _entry$contentRect = entry.contentRect,
|
|
37
|
+
width = _entry$contentRect.width,
|
|
38
|
+
height = _entry$contentRect.height;
|
|
39
|
+
setBadgeSize(width > 70 || height > 70 ? 'medium' : 'small');
|
|
40
|
+
}));
|
|
41
|
+
if (mediaElement) {
|
|
42
|
+
observer.observe(mediaElement);
|
|
43
|
+
}
|
|
44
|
+
return function () {
|
|
45
|
+
observer.disconnect();
|
|
46
|
+
};
|
|
47
|
+
}, [mediaElement]);
|
|
48
|
+
var badgeDimensions = badgeSize === 'medium' ? '24px' : '16px';
|
|
49
|
+
return jsx("div", {
|
|
50
|
+
css: commentBadgeWrapper
|
|
51
|
+
}, jsx(CustomThemeButton, {
|
|
52
|
+
style: {
|
|
53
|
+
height: badgeDimensions,
|
|
54
|
+
width: badgeDimensions,
|
|
55
|
+
background: "var(--ds-background-accent-yellow-subtler, #F8E6A0)",
|
|
56
|
+
display: 'flex',
|
|
57
|
+
justifyContent: 'center',
|
|
58
|
+
alignItems: 'center'
|
|
59
|
+
},
|
|
60
|
+
onClick: onClick,
|
|
61
|
+
iconAfter: jsx(CommentIcon, {
|
|
62
|
+
label: title,
|
|
63
|
+
size: badgeSize
|
|
64
|
+
})
|
|
65
|
+
}));
|
|
66
|
+
};
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export { MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH, MEDIA_SINGLE_VIDEO_MIN_PIXEL_WIDTH, MEDIA_SINGLE_SNAP_GAP, MEDIA_SINGLE_HIGHLIGHT_GAP, MEDIA_SINGLE_GUTTER_SIZE, MEDIA_SINGLE_RESIZE_THROTTLE_TIME, Layout as MediaSingleLayout, DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, wrappedLayouts, CAPTION_PLACEHOLDER_ID } from './constants';
|
|
2
|
-
export { getMediaSinglePixelWidth, calcMediaSinglePixelWidth, calcMediaSingleMaxWidth, getMediaSingleInitialWidth, calculateOffsetLeft, roundToNearest, calcMinWidth, getMaxWidthForNestedNode, getMaxWidthForNestedNodeNext, currentMediaNodeWithPos } from './utils';
|
|
2
|
+
export { getMediaSinglePixelWidth, calcMediaSinglePixelWidth, calcMediaSingleMaxWidth, getMediaSingleInitialWidth, calculateOffsetLeft, roundToNearest, calcMinWidth, getMaxWidthForNestedNode, getMaxWidthForNestedNodeNext, currentMediaNodeWithPos } from './utils';
|
|
3
|
+
export { CommentBadge } from './CommentBadge';
|
|
@@ -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.23.
|
|
9
|
+
var packageVersion = "78.23.8";
|
|
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
|
|
@@ -69,6 +69,6 @@ export var annotationSharedStyles = function annotationSharedStyles() {
|
|
|
69
69
|
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ProseMirror {\n .", " {\n ", ";\n }\n\n .", " {\n ", ";\n cursor: initial;\n }\n\n .", " {\n ", ";\n }\n\n // Styling for comments on media node\n .", "[class*=ak-editor-block-annotation-] {\n border-radius: 3px;\n }\n\n .", ".", " {\n box-shadow: ", ";\n }\n\n .", ".", " {\n box-shadow: ", ";\n }\n\n .", ".", " {\n box-shadow: ", ";\n }\n }\n"])), AnnotationSharedClassNames.focus, AnnotationSharedCSSByState().focus, AnnotationSharedClassNames.draft, AnnotationSharedCSSByState().focus, AnnotationSharedClassNames.blur, AnnotationSharedCSSByState().blur, mediaNodeDomRef, mediaNodeDomRef, BlockAnnotationSharedClassNames.draft, commentStatusStyleMap('draft'), mediaNodeDomRef, BlockAnnotationSharedClassNames.focus, commentStatusStyleMap('focus'), mediaNodeDomRef, BlockAnnotationSharedClassNames.blur, commentStatusStyleMap('blur'));
|
|
70
70
|
};
|
|
71
71
|
export var mediaAnnotationStyles = css({
|
|
72
|
-
boxShadow: "
|
|
72
|
+
boxShadow: "3px 3px ".concat("var(--ds-background-accent-yellow-subtler, ".concat(Y75a, ")")),
|
|
73
73
|
borderRadius: '3px'
|
|
74
74
|
});
|
|
@@ -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.23.
|
|
20
|
+
var packageVersion = "78.23.8";
|
|
21
21
|
var halfFocusRing = 1;
|
|
22
22
|
var dropOffset = '0, 8';
|
|
23
23
|
var DropList = /*#__PURE__*/function (_Component) {
|
|
@@ -17,14 +17,14 @@ import type { LengthGuide } from './types';
|
|
|
17
17
|
* @param lengths A colection of length values which will be split into a left & right guides.
|
|
18
18
|
* @returns A collection of LengthGuide objects which can be used to draw left & right guides
|
|
19
19
|
*/
|
|
20
|
-
export declare const createGuidesFromLengths: (lengths: number[],
|
|
20
|
+
export declare const createGuidesFromLengths: (lengths: number[], hasFullWidthGuide?: boolean) => LengthGuide[];
|
|
21
21
|
/**
|
|
22
22
|
* This creates a Guideline configuration generating a collection of guideline pairs from each supplied length value.
|
|
23
23
|
* Each length value generates a guideline config for both the left and right side of the length.
|
|
24
24
|
* When length is 0, generate a guideline at position: {x: 0}
|
|
25
25
|
*
|
|
26
26
|
*/
|
|
27
|
-
export declare const createFixedGuidelinesFromLengths: (lengths: number[], key?: string,
|
|
27
|
+
export declare const createFixedGuidelinesFromLengths: (lengths: number[], key?: string, hasFullWidthGuide?: boolean) => {
|
|
28
28
|
key: string;
|
|
29
29
|
position: {
|
|
30
30
|
x: number;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx } from '@emotion/react';
|
|
2
|
+
import type { IntlShape } from 'react-intl-next';
|
|
3
|
+
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
4
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
+
type CommentBadgeProps = {
|
|
6
|
+
intl: IntlShape;
|
|
7
|
+
mediaNode: PMNode | null;
|
|
8
|
+
view: EditorView;
|
|
9
|
+
mediaElement?: HTMLElement;
|
|
10
|
+
onClick: () => void;
|
|
11
|
+
};
|
|
12
|
+
export declare const CommentBadge: ({ intl, mediaNode, mediaElement, onClick, }: CommentBadgeProps) => jsx.JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export { MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH, MEDIA_SINGLE_VIDEO_MIN_PIXEL_WIDTH, MEDIA_SINGLE_SNAP_GAP, MEDIA_SINGLE_HIGHLIGHT_GAP, MEDIA_SINGLE_GUTTER_SIZE, MEDIA_SINGLE_RESIZE_THROTTLE_TIME, Layout as MediaSingleLayout, DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, wrappedLayouts, CAPTION_PLACEHOLDER_ID, } from './constants';
|
|
2
2
|
export { getMediaSinglePixelWidth, calcMediaSinglePixelWidth, calcMediaSingleMaxWidth, getMediaSingleInitialWidth, calculateOffsetLeft, roundToNearest, calcMinWidth, getMaxWidthForNestedNode, getMaxWidthForNestedNodeNext, currentMediaNodeWithPos, } from './utils';
|
|
3
|
+
export { CommentBadge } from './CommentBadge';
|
|
@@ -17,14 +17,14 @@ import type { LengthGuide } from './types';
|
|
|
17
17
|
* @param lengths A colection of length values which will be split into a left & right guides.
|
|
18
18
|
* @returns A collection of LengthGuide objects which can be used to draw left & right guides
|
|
19
19
|
*/
|
|
20
|
-
export declare const createGuidesFromLengths: (lengths: number[],
|
|
20
|
+
export declare const createGuidesFromLengths: (lengths: number[], hasFullWidthGuide?: boolean) => LengthGuide[];
|
|
21
21
|
/**
|
|
22
22
|
* This creates a Guideline configuration generating a collection of guideline pairs from each supplied length value.
|
|
23
23
|
* Each length value generates a guideline config for both the left and right side of the length.
|
|
24
24
|
* When length is 0, generate a guideline at position: {x: 0}
|
|
25
25
|
*
|
|
26
26
|
*/
|
|
27
|
-
export declare const createFixedGuidelinesFromLengths: (lengths: number[], key?: string,
|
|
27
|
+
export declare const createFixedGuidelinesFromLengths: (lengths: number[], key?: string, hasFullWidthGuide?: boolean) => {
|
|
28
28
|
key: string;
|
|
29
29
|
position: {
|
|
30
30
|
x: number;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx } from '@emotion/react';
|
|
2
|
+
import type { IntlShape } from 'react-intl-next';
|
|
3
|
+
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
4
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
+
type CommentBadgeProps = {
|
|
6
|
+
intl: IntlShape;
|
|
7
|
+
mediaNode: PMNode | null;
|
|
8
|
+
view: EditorView;
|
|
9
|
+
mediaElement?: HTMLElement;
|
|
10
|
+
onClick: () => void;
|
|
11
|
+
};
|
|
12
|
+
export declare const CommentBadge: ({ intl, mediaNode, mediaElement, onClick, }: CommentBadgeProps) => jsx.JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export { MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH, MEDIA_SINGLE_VIDEO_MIN_PIXEL_WIDTH, MEDIA_SINGLE_SNAP_GAP, MEDIA_SINGLE_HIGHLIGHT_GAP, MEDIA_SINGLE_GUTTER_SIZE, MEDIA_SINGLE_RESIZE_THROTTLE_TIME, Layout as MediaSingleLayout, DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, wrappedLayouts, CAPTION_PLACEHOLDER_ID, } from './constants';
|
|
2
2
|
export { getMediaSinglePixelWidth, calcMediaSinglePixelWidth, calcMediaSingleMaxWidth, getMediaSingleInitialWidth, calculateOffsetLeft, roundToNearest, calcMinWidth, getMaxWidthForNestedNode, getMaxWidthForNestedNodeNext, currentMediaNodeWithPos, } from './utils';
|
|
3
|
+
export { CommentBadge } from './CommentBadge';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-common",
|
|
3
|
-
"version": "78.23.
|
|
3
|
+
"version": "78.23.8",
|
|
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/"
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"@atlaskit/analytics-namespaced-context": "^6.9.0",
|
|
101
101
|
"@atlaskit/analytics-next": "^9.2.0",
|
|
102
102
|
"@atlaskit/analytics-next-stable-react-context": "1.0.1",
|
|
103
|
-
"@atlaskit/button": "^17.
|
|
103
|
+
"@atlaskit/button": "^17.10.0",
|
|
104
104
|
"@atlaskit/code": "^15.1.0",
|
|
105
105
|
"@atlaskit/codemod-utils": "^4.2.0",
|
|
106
106
|
"@atlaskit/custom-steps": "^0.0.17",
|