@atlaskit/editor-common 74.17.1 → 74.19.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 (42) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/guideline/constants.js +8 -0
  3. package/dist/cjs/guideline/dynamicGuideline.js +73 -0
  4. package/dist/cjs/guideline/index.js +12 -0
  5. package/dist/cjs/guideline/types.js +12 -0
  6. package/dist/cjs/monitoring/error.js +1 -1
  7. package/dist/cjs/ui/DropList/index.js +1 -1
  8. package/dist/cjs/ui/MediaSingle/index.js +8 -1
  9. package/dist/cjs/ui/index.js +6 -0
  10. package/dist/cjs/version.json +1 -1
  11. package/dist/es2019/guideline/constants.js +1 -0
  12. package/dist/es2019/guideline/dynamicGuideline.js +68 -0
  13. package/dist/es2019/guideline/index.js +1 -0
  14. package/dist/es2019/guideline/types.js +5 -0
  15. package/dist/es2019/monitoring/error.js +1 -1
  16. package/dist/es2019/ui/DropList/index.js +1 -1
  17. package/dist/es2019/ui/MediaSingle/index.js +6 -0
  18. package/dist/es2019/ui/index.js +1 -1
  19. package/dist/es2019/version.json +1 -1
  20. package/dist/esm/guideline/constants.js +1 -0
  21. package/dist/esm/guideline/dynamicGuideline.js +65 -0
  22. package/dist/esm/guideline/index.js +1 -0
  23. package/dist/esm/guideline/types.js +5 -0
  24. package/dist/esm/monitoring/error.js +1 -1
  25. package/dist/esm/ui/DropList/index.js +1 -1
  26. package/dist/esm/ui/MediaSingle/index.js +6 -0
  27. package/dist/esm/ui/index.js +1 -1
  28. package/dist/esm/version.json +1 -1
  29. package/dist/types/guideline/constants.d.ts +1 -0
  30. package/dist/types/guideline/dynamicGuideline.d.ts +16 -0
  31. package/dist/types/guideline/index.d.ts +1 -0
  32. package/dist/types/guideline/types.d.ts +4 -0
  33. package/dist/types/ui/MediaSingle/index.d.ts +1 -0
  34. package/dist/types/ui/index.d.ts +1 -1
  35. package/dist/types-ts4.5/guideline/constants.d.ts +1 -0
  36. package/dist/types-ts4.5/guideline/dynamicGuideline.d.ts +16 -0
  37. package/dist/types-ts4.5/guideline/index.d.ts +1 -0
  38. package/dist/types-ts4.5/guideline/types.d.ts +4 -0
  39. package/dist/types-ts4.5/ui/MediaSingle/index.d.ts +1 -0
  40. package/dist/types-ts4.5/ui/index.d.ts +1 -1
  41. package/guideline/package.json +15 -0
  42. package/package.json +6 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 74.19.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`f486dbd535c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f486dbd535c) - MEX-2481 Fix minor gap between image and border
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+
13
+ ## 74.18.0
14
+
15
+ ### Minor Changes
16
+
17
+ - [`11285b1d77e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/11285b1d77e) - ED-18971 Added editor dynamic guideline util and new guideline entry point in editor-common
18
+
3
19
  ## 74.17.1
4
20
 
5
21
  ### Patch Changes
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.MEDIA_DYNAMIC_GUIDELINE_PREFIX = void 0;
7
+ var MEDIA_DYNAMIC_GUIDELINE_PREFIX = 'media_';
8
+ exports.MEDIA_DYNAMIC_GUIDELINE_PREFIX = MEDIA_DYNAMIC_GUIDELINE_PREFIX;
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.generateDynamicGuidelines = void 0;
8
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
+ var _prosemirrorState = require("prosemirror-state");
10
+ var _prosemirrorUtils = require("prosemirror-utils");
11
+ var _constants = require("./constants");
12
+ var _types = require("./types");
13
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
14
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
15
+ var generateDynamicGuidelines = function generateDynamicGuidelines(state, editorWidth) {
16
+ var selectedNode = state.selection instanceof _prosemirrorState.NodeSelection && state.selection.node;
17
+ var mediaSingleNode = (0, _prosemirrorUtils.findChildren)(state.tr.doc, function (node) {
18
+ return node.type === state.schema.nodes.mediaSingle;
19
+ }, false // only top level
20
+ );
21
+
22
+ var offset = editorWidth / 2;
23
+ return mediaSingleNode.map(function (_ref, index) {
24
+ var node = _ref.node;
25
+ if (selectedNode === node) {
26
+ return [];
27
+ }
28
+ var _node$attrs = node.attrs,
29
+ layout = _node$attrs.layout,
30
+ width = _node$attrs.width,
31
+ widthType = _node$attrs.widthType;
32
+ var pixelWidth = !widthType || widthType === _types.WidthTypes.PERCENTAGE ? width / 100 * editorWidth : width;
33
+ var commonStyles = {
34
+ style: 'dashed',
35
+ show: true
36
+ };
37
+ var key = "".concat(_constants.MEDIA_DYNAMIC_GUIDELINE_PREFIX).concat(index);
38
+ switch (layout) {
39
+ case 'align-start':
40
+ case 'wrap-left':
41
+ return _objectSpread({
42
+ position: {
43
+ x: pixelWidth - offset
44
+ },
45
+ key: key
46
+ }, commonStyles);
47
+ case 'align-end':
48
+ case 'wrap-right':
49
+ return _objectSpread({
50
+ position: {
51
+ x: editorWidth - pixelWidth - offset
52
+ },
53
+ key: key
54
+ }, commonStyles);
55
+ case 'center':
56
+ return [_objectSpread({
57
+ position: {
58
+ x: pixelWidth / 2
59
+ },
60
+ key: "".concat(key, "_right")
61
+ }, commonStyles), _objectSpread({
62
+ position: {
63
+ x: -pixelWidth / 2
64
+ },
65
+ key: "".concat(key, "_left")
66
+ }, commonStyles)];
67
+ // we ignore full-width and wide
68
+ default:
69
+ return [];
70
+ }
71
+ }).flat();
72
+ };
73
+ exports.generateDynamicGuidelines = generateDynamicGuidelines;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "generateDynamicGuidelines", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _dynamicGuideline.generateDynamicGuidelines;
10
+ }
11
+ });
12
+ var _dynamicGuideline = require("./dynamicGuideline");
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.WidthTypes = void 0;
7
+ var WidthTypes = /*#__PURE__*/function (WidthTypes) {
8
+ WidthTypes["PERCENTAGE"] = "percentage";
9
+ WidthTypes["PIXEL"] = "pixel";
10
+ return WidthTypes;
11
+ }({});
12
+ exports.WidthTypes = WidthTypes;
@@ -16,7 +16,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
16
16
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
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 = "74.17.1";
19
+ var packageVersion = "74.19.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
@@ -24,7 +24,7 @@ var _templateObject, _templateObject2, _templateObject3;
24
24
  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); }; }
25
25
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /** @jsx jsx */
26
26
  var packageName = "@atlaskit/editor-common";
27
- var packageVersion = "74.17.1";
27
+ var packageVersion = "74.19.0";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var DropList = /*#__PURE__*/function (_Component) {
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.DEFAULT_IMAGE_WIDTH = exports.DEFAULT_IMAGE_HEIGHT = void 0;
7
+ exports.IMAGE_AND_BORDER_ADJUSTMENT = exports.DEFAULT_IMAGE_WIDTH = exports.DEFAULT_IMAGE_HEIGHT = void 0;
8
8
  exports.default = MediaSingle;
9
9
  exports.shouldAddDefaultWrappedWidth = void 0;
10
10
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
@@ -19,7 +19,14 @@ var _styled = require("./styled");
19
19
  var DEFAULT_IMAGE_WIDTH = 250;
20
20
  exports.DEFAULT_IMAGE_WIDTH = DEFAULT_IMAGE_WIDTH;
21
21
  var DEFAULT_IMAGE_HEIGHT = 200;
22
+
23
+ /*
24
+ This constant is used to proportionally adjust the image and its border to avoid any gaps. i.e. The value will simultaneously expand the width and height of the image by 2 pixels; and similarly contract the border by 2 pixels.
25
+ Read more: https://product-fabric.atlassian.net/browse/MEX-2481
26
+ */
22
27
  exports.DEFAULT_IMAGE_HEIGHT = DEFAULT_IMAGE_HEIGHT;
28
+ var IMAGE_AND_BORDER_ADJUSTMENT = 2;
29
+ exports.IMAGE_AND_BORDER_ADJUSTMENT = IMAGE_AND_BORDER_ADJUSTMENT;
23
30
  var shouldAddDefaultWrappedWidth = function shouldAddDefaultWrappedWidth(layout, width, lineLength) {
24
31
  return _grid.wrappedLayouts.indexOf(layout) > -1 && lineLength && width && width > 0.5 * lineLength;
25
32
  };
@@ -83,6 +83,12 @@ Object.defineProperty(exports, "HelperMessage", {
83
83
  return _Messages.HelperMessage;
84
84
  }
85
85
  });
86
+ Object.defineProperty(exports, "IMAGE_AND_BORDER_ADJUSTMENT", {
87
+ enumerable: true,
88
+ get: function get() {
89
+ return _MediaSingle.IMAGE_AND_BORDER_ADJUSTMENT;
90
+ }
91
+ });
86
92
  Object.defineProperty(exports, "IntlErrorBoundary", {
87
93
  enumerable: true,
88
94
  get: function get() {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "74.17.1",
3
+ "version": "74.19.0",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1 @@
1
+ export const MEDIA_DYNAMIC_GUIDELINE_PREFIX = 'media_';
@@ -0,0 +1,68 @@
1
+ import { NodeSelection } from 'prosemirror-state';
2
+ import { findChildren } from 'prosemirror-utils';
3
+ import { MEDIA_DYNAMIC_GUIDELINE_PREFIX } from './constants';
4
+ import { WidthTypes } from './types';
5
+ export const generateDynamicGuidelines = (state, editorWidth) => {
6
+ const selectedNode = state.selection instanceof NodeSelection && state.selection.node;
7
+ const mediaSingleNode = findChildren(state.tr.doc, node => {
8
+ return node.type === state.schema.nodes.mediaSingle;
9
+ }, false // only top level
10
+ );
11
+
12
+ const offset = editorWidth / 2;
13
+ return mediaSingleNode.map(({
14
+ node
15
+ }, index) => {
16
+ if (selectedNode === node) {
17
+ return [];
18
+ }
19
+ const {
20
+ layout,
21
+ width,
22
+ widthType
23
+ } = node.attrs;
24
+ const pixelWidth = !widthType || widthType === WidthTypes.PERCENTAGE ? width / 100 * editorWidth : width;
25
+ const commonStyles = {
26
+ style: 'dashed',
27
+ show: true
28
+ };
29
+ const key = `${MEDIA_DYNAMIC_GUIDELINE_PREFIX}${index}`;
30
+ switch (layout) {
31
+ case 'align-start':
32
+ case 'wrap-left':
33
+ return {
34
+ position: {
35
+ x: pixelWidth - offset
36
+ },
37
+ key,
38
+ ...commonStyles
39
+ };
40
+ case 'align-end':
41
+ case 'wrap-right':
42
+ return {
43
+ position: {
44
+ x: editorWidth - pixelWidth - offset
45
+ },
46
+ key,
47
+ ...commonStyles
48
+ };
49
+ case 'center':
50
+ return [{
51
+ position: {
52
+ x: pixelWidth / 2
53
+ },
54
+ key: `${key}_right`,
55
+ ...commonStyles
56
+ }, {
57
+ position: {
58
+ x: -pixelWidth / 2
59
+ },
60
+ key: `${key}_left`,
61
+ ...commonStyles
62
+ }];
63
+ // we ignore full-width and wide
64
+ default:
65
+ return [];
66
+ }
67
+ }).flat();
68
+ };
@@ -0,0 +1 @@
1
+ export { generateDynamicGuidelines } from './dynamicGuideline';
@@ -0,0 +1,5 @@
1
+ export let WidthTypes = /*#__PURE__*/function (WidthTypes) {
2
+ WidthTypes["PERCENTAGE"] = "percentage";
3
+ WidthTypes["PIXEL"] = "pixel";
4
+ return WidthTypes;
5
+ }({});
@@ -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 = "74.17.1";
3
+ const packageVersion = "74.19.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
@@ -8,7 +8,7 @@ import { themed } from '@atlaskit/theme/components';
8
8
  import { borderRadius } from '@atlaskit/theme/constants';
9
9
  import Layer from '../Layer';
10
10
  const packageName = "@atlaskit/editor-common";
11
- const packageVersion = "74.17.1";
11
+ const packageVersion = "74.19.0";
12
12
  const halfFocusRing = 1;
13
13
  const dropOffset = '0, 8';
14
14
  class DropList extends Component {
@@ -7,6 +7,12 @@ import { calcPxFromPct, wrappedLayouts } from './grid';
7
7
  import { MediaSingleDimensionHelper, MediaWrapper } from './styled';
8
8
  export const DEFAULT_IMAGE_WIDTH = 250;
9
9
  export const DEFAULT_IMAGE_HEIGHT = 200;
10
+
11
+ /*
12
+ This constant is used to proportionally adjust the image and its border to avoid any gaps. i.e. The value will simultaneously expand the width and height of the image by 2 pixels; and similarly contract the border by 2 pixels.
13
+ Read more: https://product-fabric.atlassian.net/browse/MEX-2481
14
+ */
15
+ export const IMAGE_AND_BORDER_ADJUSTMENT = 2;
10
16
  export const shouldAddDefaultWrappedWidth = (layout, width, lineLength) => {
11
17
  return wrappedLayouts.indexOf(layout) > -1 && lineLength && width && width > 0.5 * lineLength;
12
18
  };
@@ -1,5 +1,5 @@
1
1
  export { default as Caption } from './Caption';
2
- export { default as MediaSingle, DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, shouldAddDefaultWrappedWidth } from './MediaSingle';
2
+ export { default as MediaSingle, DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, IMAGE_AND_BORDER_ADJUSTMENT, shouldAddDefaultWrappedWidth } from './MediaSingle';
3
3
  export { MediaSingleDimensionHelper } from './MediaSingle/styled';
4
4
  export { layoutSupportsWidth, calcPxFromColumns, calcPctFromPx, calcPxFromPct, calcColumnsFromPx, snapToGrid, calcMediaPxWidth, wrappedLayouts } from './MediaSingle/grid';
5
5
  export { mediaLinkStyle } from './MediaSingle/link';
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "74.17.1",
3
+ "version": "74.19.0",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1 @@
1
+ export var MEDIA_DYNAMIC_GUIDELINE_PREFIX = 'media_';
@@ -0,0 +1,65 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
+ import { NodeSelection } from 'prosemirror-state';
5
+ import { findChildren } from 'prosemirror-utils';
6
+ import { MEDIA_DYNAMIC_GUIDELINE_PREFIX } from './constants';
7
+ import { WidthTypes } from './types';
8
+ export var generateDynamicGuidelines = function generateDynamicGuidelines(state, editorWidth) {
9
+ var selectedNode = state.selection instanceof NodeSelection && state.selection.node;
10
+ var mediaSingleNode = findChildren(state.tr.doc, function (node) {
11
+ return node.type === state.schema.nodes.mediaSingle;
12
+ }, false // only top level
13
+ );
14
+
15
+ var offset = editorWidth / 2;
16
+ return mediaSingleNode.map(function (_ref, index) {
17
+ var node = _ref.node;
18
+ if (selectedNode === node) {
19
+ return [];
20
+ }
21
+ var _node$attrs = node.attrs,
22
+ layout = _node$attrs.layout,
23
+ width = _node$attrs.width,
24
+ widthType = _node$attrs.widthType;
25
+ var pixelWidth = !widthType || widthType === WidthTypes.PERCENTAGE ? width / 100 * editorWidth : width;
26
+ var commonStyles = {
27
+ style: 'dashed',
28
+ show: true
29
+ };
30
+ var key = "".concat(MEDIA_DYNAMIC_GUIDELINE_PREFIX).concat(index);
31
+ switch (layout) {
32
+ case 'align-start':
33
+ case 'wrap-left':
34
+ return _objectSpread({
35
+ position: {
36
+ x: pixelWidth - offset
37
+ },
38
+ key: key
39
+ }, commonStyles);
40
+ case 'align-end':
41
+ case 'wrap-right':
42
+ return _objectSpread({
43
+ position: {
44
+ x: editorWidth - pixelWidth - offset
45
+ },
46
+ key: key
47
+ }, commonStyles);
48
+ case 'center':
49
+ return [_objectSpread({
50
+ position: {
51
+ x: pixelWidth / 2
52
+ },
53
+ key: "".concat(key, "_right")
54
+ }, commonStyles), _objectSpread({
55
+ position: {
56
+ x: -pixelWidth / 2
57
+ },
58
+ key: "".concat(key, "_left")
59
+ }, commonStyles)];
60
+ // we ignore full-width and wide
61
+ default:
62
+ return [];
63
+ }
64
+ }).flat();
65
+ };
@@ -0,0 +1 @@
1
+ export { generateDynamicGuidelines } from './dynamicGuideline';
@@ -0,0 +1,5 @@
1
+ export var WidthTypes = /*#__PURE__*/function (WidthTypes) {
2
+ WidthTypes["PERCENTAGE"] = "percentage";
3
+ WidthTypes["PIXEL"] = "pixel";
4
+ return WidthTypes;
5
+ }({});
@@ -6,7 +6,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
6
6
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
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 = "74.17.1";
9
+ var packageVersion = "74.19.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
@@ -18,7 +18,7 @@ import { themed } from '@atlaskit/theme/components';
18
18
  import { borderRadius } from '@atlaskit/theme/constants';
19
19
  import Layer from '../Layer';
20
20
  var packageName = "@atlaskit/editor-common";
21
- var packageVersion = "74.17.1";
21
+ var packageVersion = "74.19.0";
22
22
  var halfFocusRing = 1;
23
23
  var dropOffset = '0, 8';
24
24
  var DropList = /*#__PURE__*/function (_Component) {
@@ -8,6 +8,12 @@ import { calcPxFromPct, wrappedLayouts } from './grid';
8
8
  import { MediaSingleDimensionHelper, MediaWrapper } from './styled';
9
9
  export var DEFAULT_IMAGE_WIDTH = 250;
10
10
  export var DEFAULT_IMAGE_HEIGHT = 200;
11
+
12
+ /*
13
+ This constant is used to proportionally adjust the image and its border to avoid any gaps. i.e. The value will simultaneously expand the width and height of the image by 2 pixels; and similarly contract the border by 2 pixels.
14
+ Read more: https://product-fabric.atlassian.net/browse/MEX-2481
15
+ */
16
+ export var IMAGE_AND_BORDER_ADJUSTMENT = 2;
11
17
  export var shouldAddDefaultWrappedWidth = function shouldAddDefaultWrappedWidth(layout, width, lineLength) {
12
18
  return wrappedLayouts.indexOf(layout) > -1 && lineLength && width && width > 0.5 * lineLength;
13
19
  };
@@ -1,5 +1,5 @@
1
1
  export { default as Caption } from './Caption';
2
- export { default as MediaSingle, DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, shouldAddDefaultWrappedWidth } from './MediaSingle';
2
+ export { default as MediaSingle, DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, IMAGE_AND_BORDER_ADJUSTMENT, shouldAddDefaultWrappedWidth } from './MediaSingle';
3
3
  export { MediaSingleDimensionHelper } from './MediaSingle/styled';
4
4
  export { layoutSupportsWidth, calcPxFromColumns, calcPctFromPx, calcPxFromPct, calcColumnsFromPx, snapToGrid, calcMediaPxWidth, wrappedLayouts } from './MediaSingle/grid';
5
5
  export { mediaLinkStyle } from './MediaSingle/link';
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "74.17.1",
3
+ "version": "74.19.0",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1 @@
1
+ export declare const MEDIA_DYNAMIC_GUIDELINE_PREFIX = "media_";
@@ -0,0 +1,16 @@
1
+ import { EditorState } from 'prosemirror-state';
2
+ export declare const generateDynamicGuidelines: (state: EditorState, editorWidth: number) => ({
3
+ style: string;
4
+ show: boolean;
5
+ position: {
6
+ x: number;
7
+ };
8
+ key: string;
9
+ } | {
10
+ style: string;
11
+ show: boolean;
12
+ position: {
13
+ x: number;
14
+ };
15
+ key: string;
16
+ })[];
@@ -0,0 +1 @@
1
+ export { generateDynamicGuidelines } from './dynamicGuideline';
@@ -0,0 +1,4 @@
1
+ export declare enum WidthTypes {
2
+ PERCENTAGE = "percentage",
3
+ PIXEL = "pixel"
4
+ }
@@ -4,6 +4,7 @@ import { jsx } from '@emotion/react';
4
4
  import { RichMediaLayout as MediaSingleLayout, RichMediaLayout } from '@atlaskit/adf-schema';
5
5
  export declare const DEFAULT_IMAGE_WIDTH = 250;
6
6
  export declare const DEFAULT_IMAGE_HEIGHT = 200;
7
+ export declare const IMAGE_AND_BORDER_ADJUSTMENT = 2;
7
8
  export interface Props {
8
9
  children: React.ReactNode;
9
10
  layout: MediaSingleLayout;
@@ -1,5 +1,5 @@
1
1
  export { default as Caption } from './Caption';
2
- export { default as MediaSingle, DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, shouldAddDefaultWrappedWidth, } from './MediaSingle';
2
+ export { default as MediaSingle, DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, IMAGE_AND_BORDER_ADJUSTMENT, shouldAddDefaultWrappedWidth, } from './MediaSingle';
3
3
  export type { Props as MediaSingleProps } from './MediaSingle';
4
4
  export { MediaSingleDimensionHelper } from './MediaSingle/styled';
5
5
  export type { MediaSingleWrapperProps as MediaSingleDimensionHelperProps } from './MediaSingle/styled';
@@ -0,0 +1 @@
1
+ export declare const MEDIA_DYNAMIC_GUIDELINE_PREFIX = "media_";
@@ -0,0 +1,16 @@
1
+ import { EditorState } from 'prosemirror-state';
2
+ export declare const generateDynamicGuidelines: (state: EditorState, editorWidth: number) => ({
3
+ style: string;
4
+ show: boolean;
5
+ position: {
6
+ x: number;
7
+ };
8
+ key: string;
9
+ } | {
10
+ style: string;
11
+ show: boolean;
12
+ position: {
13
+ x: number;
14
+ };
15
+ key: string;
16
+ })[];
@@ -0,0 +1 @@
1
+ export { generateDynamicGuidelines } from './dynamicGuideline';
@@ -0,0 +1,4 @@
1
+ export declare enum WidthTypes {
2
+ PERCENTAGE = "percentage",
3
+ PIXEL = "pixel"
4
+ }
@@ -4,6 +4,7 @@ import { jsx } from '@emotion/react';
4
4
  import { RichMediaLayout as MediaSingleLayout, RichMediaLayout } from '@atlaskit/adf-schema';
5
5
  export declare const DEFAULT_IMAGE_WIDTH = 250;
6
6
  export declare const DEFAULT_IMAGE_HEIGHT = 200;
7
+ export declare const IMAGE_AND_BORDER_ADJUSTMENT = 2;
7
8
  export interface Props {
8
9
  children: React.ReactNode;
9
10
  layout: MediaSingleLayout;
@@ -1,5 +1,5 @@
1
1
  export { default as Caption } from './Caption';
2
- export { default as MediaSingle, DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, shouldAddDefaultWrappedWidth, } from './MediaSingle';
2
+ export { default as MediaSingle, DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, IMAGE_AND_BORDER_ADJUSTMENT, shouldAddDefaultWrappedWidth, } from './MediaSingle';
3
3
  export type { Props as MediaSingleProps } from './MediaSingle';
4
4
  export { MediaSingleDimensionHelper } from './MediaSingle/styled';
5
5
  export type { MediaSingleWrapperProps as MediaSingleDimensionHelperProps } from './MediaSingle/styled';
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "@atlaskit/editor-common/guideline",
3
+ "main": "../dist/cjs/guideline/index.js",
4
+ "module": "../dist/esm/guideline/index.js",
5
+ "module:es2019": "../dist/es2019/guideline/index.js",
6
+ "sideEffects": false,
7
+ "types": "../dist/types/guideline/index.d.ts",
8
+ "typesVersions": {
9
+ ">=4.5 <4.9": {
10
+ "*": [
11
+ "../dist/types-ts4.5/guideline/index.d.ts"
12
+ ]
13
+ }
14
+ }
15
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "74.17.1",
3
+ "version": "74.19.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/"
@@ -69,7 +69,8 @@
69
69
  "./paste": "./src/paste/index.ts",
70
70
  "./resizer": "./src/resizer/index.ts",
71
71
  "./editor-analytics": "./src/editor-analytics/index.ts",
72
- "./selection-based-node-view": "./src/selection-based-node-view/index.ts"
72
+ "./selection-based-node-view": "./src/selection-based-node-view/index.ts",
73
+ "./guideline": "./src/guideline/index.ts"
73
74
  },
74
75
  "dependencies": {
75
76
  "@atlaskit/activity-provider": "^2.4.0",
@@ -82,13 +83,13 @@
82
83
  "@atlaskit/button": "^16.8.0",
83
84
  "@atlaskit/code": "^14.6.0",
84
85
  "@atlaskit/codemod-utils": "^4.2.0",
85
- "@atlaskit/collab-provider": "^9.5.0",
86
+ "@atlaskit/collab-provider": "^9.6.0",
86
87
  "@atlaskit/editor-palette": "1.5.1",
87
88
  "@atlaskit/editor-shared-styles": "^2.4.0",
88
89
  "@atlaskit/emoji": "^67.4.0",
89
90
  "@atlaskit/icon": "^21.12.0",
90
91
  "@atlaskit/in-product-testing": "^0.2.0",
91
- "@atlaskit/media-card": "^76.0.0",
92
+ "@atlaskit/media-card": "^76.1.0",
92
93
  "@atlaskit/media-client": "^23.1.0",
93
94
  "@atlaskit/media-picker": "^66.1.0",
94
95
  "@atlaskit/mention": "^22.1.0",
@@ -134,7 +135,7 @@
134
135
  },
135
136
  "devDependencies": {
136
137
  "@atlaskit/editor-json-transformer": "^8.10.0",
137
- "@atlaskit/editor-test-helpers": "^18.9.0",
138
+ "@atlaskit/editor-test-helpers": "^18.10.0",
138
139
  "@atlaskit/media-core": "^34.1.0",
139
140
  "@atlaskit/media-test-helpers": "^33.0.0",
140
141
  "@atlaskit/smart-card": "^26.9.0",