@atlaskit/editor-plugin-media 1.28.0 → 1.28.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @atlaskit/editor-plugin-media
2
2
 
3
+ ## 1.28.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#128613](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/128613)
8
+ [`9ca6a3874ec07`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9ca6a3874ec07) -
9
+ [ED-24516] Fix prepareDiff to avoid toDOM usage
10
+ - Updated dependencies
11
+
3
12
  ## 1.28.0
4
13
 
5
14
  ### Minor Changes
@@ -128,14 +128,13 @@ var mediaSingleSpecWithFixedToDOM = exports.mediaSingleSpecWithFixedToDOM = func
128
128
  }
129
129
  return _objectSpread(_objectSpread({}, mediaSingleNode), {}, {
130
130
  toDOM: function toDOM(node) {
131
- var _mediaSingleAttrs$lay, _childNode$type;
131
+ var _mediaSingleAttrs$lay;
132
132
  var childNode = node.firstChild;
133
133
  var mediaSingleAttrs = node.attrs;
134
134
  var layout = (_mediaSingleAttrs$lay = mediaSingleAttrs === null || mediaSingleAttrs === void 0 ? void 0 : mediaSingleAttrs.layout) !== null && _mediaSingleAttrs$lay !== void 0 ? _mediaSingleAttrs$lay : 'center';
135
135
  var mediaSingleWidth = mediaSingleAttrs === null || mediaSingleAttrs === void 0 ? void 0 : mediaSingleAttrs.width;
136
136
  var widthType = mediaSingleAttrs === null || mediaSingleAttrs === void 0 ? void 0 : mediaSingleAttrs.widthType;
137
137
  var dataAttrs = (0, _toDOMAttrs.getAttrsFromNodeMediaSingle)(mediaSingleOption.withExtendedWidthTypes, node);
138
- var mediaAttrs = (childNode === null || childNode === void 0 || (_childNode$type = childNode.type) === null || _childNode$type === void 0 ? void 0 : _childNode$type.name) === 'media' ? (0, _toDOMAttrs.getMediaAttrs)('media', childNode) : undefined;
139
138
  var _computeMediaSingleDi = computeMediaSingleDimensions({
140
139
  childNode: childNode,
141
140
  widthType: widthType,
@@ -145,16 +144,20 @@ var mediaSingleSpecWithFixedToDOM = exports.mediaSingleSpecWithFixedToDOM = func
145
144
  height = _computeMediaSingleDi.height;
146
145
  var layoutStyles = computeLayoutStyles(width, layout);
147
146
  var style = "display: block; margin-top: ".concat("var(--ds-space-300, 24px)", "; margin-bottom: ", "var(--ds-space-300, 24px)", "; ", layoutStyles);
148
- if ((childNode === null || childNode === void 0 ? void 0 : childNode.attrs.type) === 'external') {
149
- return ['div', dataAttrs, ['img', _objectSpread(_objectSpread({}, mediaAttrs), {}, {
150
- src: childNode.attrs.url,
151
- style: style
152
- })]];
153
- }
154
- return ['div', dataAttrs, ['div', _objectSpread(_objectSpread({}, mediaAttrs), {}, {
147
+ var content = ['div', _objectSpread({
148
+ class: 'rich-media-item mediaSingleView-content-wrap image-center'
149
+ }, dataAttrs), ['div', {
150
+ class: 'css-13f4nzt-MediaWrapper',
155
151
  // Transparent image workaround to control styling
156
152
  style: "width: ".concat(width, "px; height: ").concat(height, "px; ").concat(style, " ").concat(skeletonStyling, " border-radius: ", "var(--ds-border-radius, 3px)", ";")
157
- })]];
153
+ }, ['figure', {
154
+ class: 'media-single-node'
155
+ }, ['div', {}, ['div', {
156
+ class: 'media-content-wrap'
157
+ }, 0]]]]];
158
+ return ['div', {
159
+ class: 'mediaSingleView-content-wrap'
160
+ }, content];
158
161
  }
159
162
  });
160
163
  };
@@ -64,17 +64,13 @@ var getAttrsFromNodeMediaSingle = exports.getAttrsFromNodeMediaSingle = function
64
64
  width = _node$attrs.width;
65
65
  var attrs = {
66
66
  'data-node-type': 'mediaSingle',
67
- 'data-layout': layout,
68
- 'data-width': ''
67
+ 'data-layout': layout
69
68
  };
70
69
  if (width) {
71
70
  attrs['data-width'] = isFinite(width) && Math.floor(width) === width ? width : width.toFixed(2);
72
71
  }
73
- if (withExtendedWidthTypes && node.attrs.widthType) {
74
- var widthType = node.attrs.widthType;
75
- return _objectSpread(_objectSpread({}, attrs), {}, {
76
- 'data-width-type': widthType || 'percentage'
77
- });
78
- }
79
- return attrs;
72
+ var widthType = node.attrs.widthType;
73
+ return _objectSpread(_objectSpread({}, attrs), {}, {
74
+ 'data-width-type': widthType || 'percentage'
75
+ });
80
76
  };
@@ -1,6 +1,6 @@
1
1
  import { mediaSingleSpec } from '@atlaskit/adf-schema';
2
2
  import { fg } from '@atlaskit/platform-feature-flags';
3
- import { getAttrsFromNodeMediaSingle, getMediaAttrs } from './toDOMAttrs';
3
+ import { getAttrsFromNodeMediaSingle } from './toDOMAttrs';
4
4
  const skeletonStyling = `background: ${"var(--ds-background-neutral, #091E420F)"}; outline: none;`;
5
5
  export const wrappedLayouts = ['wrap-left', 'wrap-right', 'align-end', 'align-start'];
6
6
 
@@ -117,14 +117,13 @@ export const mediaSingleSpecWithFixedToDOM = mediaSingleOption => {
117
117
  return {
118
118
  ...mediaSingleNode,
119
119
  toDOM: node => {
120
- var _mediaSingleAttrs$lay, _childNode$type;
120
+ var _mediaSingleAttrs$lay;
121
121
  const childNode = node.firstChild;
122
122
  const mediaSingleAttrs = node.attrs;
123
123
  const layout = (_mediaSingleAttrs$lay = mediaSingleAttrs === null || mediaSingleAttrs === void 0 ? void 0 : mediaSingleAttrs.layout) !== null && _mediaSingleAttrs$lay !== void 0 ? _mediaSingleAttrs$lay : 'center';
124
124
  const mediaSingleWidth = mediaSingleAttrs === null || mediaSingleAttrs === void 0 ? void 0 : mediaSingleAttrs.width;
125
125
  const widthType = mediaSingleAttrs === null || mediaSingleAttrs === void 0 ? void 0 : mediaSingleAttrs.widthType;
126
126
  const dataAttrs = getAttrsFromNodeMediaSingle(mediaSingleOption.withExtendedWidthTypes, node);
127
- const mediaAttrs = (childNode === null || childNode === void 0 ? void 0 : (_childNode$type = childNode.type) === null || _childNode$type === void 0 ? void 0 : _childNode$type.name) === 'media' ? getMediaAttrs('media', childNode) : undefined;
128
127
  const {
129
128
  width,
130
129
  height
@@ -135,18 +134,21 @@ export const mediaSingleSpecWithFixedToDOM = mediaSingleOption => {
135
134
  });
136
135
  const layoutStyles = computeLayoutStyles(width, layout);
137
136
  const style = `display: block; margin-top: ${"var(--ds-space-300, 24px)"}; margin-bottom: ${"var(--ds-space-300, 24px)"}; ${layoutStyles}`;
138
- if ((childNode === null || childNode === void 0 ? void 0 : childNode.attrs.type) === 'external') {
139
- return ['div', dataAttrs, ['img', {
140
- ...mediaAttrs,
141
- src: childNode.attrs.url,
142
- style
143
- }]];
144
- }
145
- return ['div', dataAttrs, ['div', {
146
- ...mediaAttrs,
137
+ const content = ['div', {
138
+ class: 'rich-media-item mediaSingleView-content-wrap image-center',
139
+ ...dataAttrs
140
+ }, ['div', {
141
+ class: 'css-13f4nzt-MediaWrapper',
147
142
  // Transparent image workaround to control styling
148
143
  style: `width: ${width}px; height: ${height}px; ${style} ${skeletonStyling} border-radius: ${"var(--ds-border-radius, 3px)"};`
149
- }]];
144
+ }, ['figure', {
145
+ class: 'media-single-node'
146
+ }, ['div', {}, ['div', {
147
+ class: 'media-content-wrap'
148
+ }, 0]]]]];
149
+ return ['div', {
150
+ class: 'mediaSingleView-content-wrap'
151
+ }, content];
150
152
  }
151
153
  };
152
154
  };
@@ -50,20 +50,16 @@ export const getAttrsFromNodeMediaSingle = (withExtendedWidthTypes, node) => {
50
50
  } = node.attrs;
51
51
  const attrs = {
52
52
  'data-node-type': 'mediaSingle',
53
- 'data-layout': layout,
54
- 'data-width': ''
53
+ 'data-layout': layout
55
54
  };
56
55
  if (width) {
57
56
  attrs['data-width'] = isFinite(width) && Math.floor(width) === width ? width : width.toFixed(2);
58
57
  }
59
- if (withExtendedWidthTypes && node.attrs.widthType) {
60
- const {
61
- widthType
62
- } = node.attrs;
63
- return {
64
- ...attrs,
65
- 'data-width-type': widthType || 'percentage'
66
- };
67
- }
68
- return attrs;
58
+ const {
59
+ widthType
60
+ } = node.attrs;
61
+ return {
62
+ ...attrs,
63
+ 'data-width-type': widthType || 'percentage'
64
+ };
69
65
  };
@@ -3,7 +3,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
3
3
  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; }
4
4
  import { mediaSingleSpec } from '@atlaskit/adf-schema';
5
5
  import { fg } from '@atlaskit/platform-feature-flags';
6
- import { getAttrsFromNodeMediaSingle, getMediaAttrs } from './toDOMAttrs';
6
+ import { getAttrsFromNodeMediaSingle } from './toDOMAttrs';
7
7
  var skeletonStyling = "background: ".concat("var(--ds-background-neutral, #091E420F)", "; outline: none;");
8
8
  export var wrappedLayouts = ['wrap-left', 'wrap-right', 'align-end', 'align-start'];
9
9
 
@@ -120,14 +120,13 @@ export var mediaSingleSpecWithFixedToDOM = function mediaSingleSpecWithFixedToDO
120
120
  }
121
121
  return _objectSpread(_objectSpread({}, mediaSingleNode), {}, {
122
122
  toDOM: function toDOM(node) {
123
- var _mediaSingleAttrs$lay, _childNode$type;
123
+ var _mediaSingleAttrs$lay;
124
124
  var childNode = node.firstChild;
125
125
  var mediaSingleAttrs = node.attrs;
126
126
  var layout = (_mediaSingleAttrs$lay = mediaSingleAttrs === null || mediaSingleAttrs === void 0 ? void 0 : mediaSingleAttrs.layout) !== null && _mediaSingleAttrs$lay !== void 0 ? _mediaSingleAttrs$lay : 'center';
127
127
  var mediaSingleWidth = mediaSingleAttrs === null || mediaSingleAttrs === void 0 ? void 0 : mediaSingleAttrs.width;
128
128
  var widthType = mediaSingleAttrs === null || mediaSingleAttrs === void 0 ? void 0 : mediaSingleAttrs.widthType;
129
129
  var dataAttrs = getAttrsFromNodeMediaSingle(mediaSingleOption.withExtendedWidthTypes, node);
130
- var mediaAttrs = (childNode === null || childNode === void 0 || (_childNode$type = childNode.type) === null || _childNode$type === void 0 ? void 0 : _childNode$type.name) === 'media' ? getMediaAttrs('media', childNode) : undefined;
131
130
  var _computeMediaSingleDi = computeMediaSingleDimensions({
132
131
  childNode: childNode,
133
132
  widthType: widthType,
@@ -137,16 +136,20 @@ export var mediaSingleSpecWithFixedToDOM = function mediaSingleSpecWithFixedToDO
137
136
  height = _computeMediaSingleDi.height;
138
137
  var layoutStyles = computeLayoutStyles(width, layout);
139
138
  var style = "display: block; margin-top: ".concat("var(--ds-space-300, 24px)", "; margin-bottom: ", "var(--ds-space-300, 24px)", "; ", layoutStyles);
140
- if ((childNode === null || childNode === void 0 ? void 0 : childNode.attrs.type) === 'external') {
141
- return ['div', dataAttrs, ['img', _objectSpread(_objectSpread({}, mediaAttrs), {}, {
142
- src: childNode.attrs.url,
143
- style: style
144
- })]];
145
- }
146
- return ['div', dataAttrs, ['div', _objectSpread(_objectSpread({}, mediaAttrs), {}, {
139
+ var content = ['div', _objectSpread({
140
+ class: 'rich-media-item mediaSingleView-content-wrap image-center'
141
+ }, dataAttrs), ['div', {
142
+ class: 'css-13f4nzt-MediaWrapper',
147
143
  // Transparent image workaround to control styling
148
144
  style: "width: ".concat(width, "px; height: ").concat(height, "px; ").concat(style, " ").concat(skeletonStyling, " border-radius: ", "var(--ds-border-radius, 3px)", ";")
149
- })]];
145
+ }, ['figure', {
146
+ class: 'media-single-node'
147
+ }, ['div', {}, ['div', {
148
+ class: 'media-content-wrap'
149
+ }, 0]]]]];
150
+ return ['div', {
151
+ class: 'mediaSingleView-content-wrap'
152
+ }, content];
150
153
  }
151
154
  });
152
155
  };
@@ -58,17 +58,13 @@ export var getAttrsFromNodeMediaSingle = function getAttrsFromNodeMediaSingle(wi
58
58
  width = _node$attrs.width;
59
59
  var attrs = {
60
60
  'data-node-type': 'mediaSingle',
61
- 'data-layout': layout,
62
- 'data-width': ''
61
+ 'data-layout': layout
63
62
  };
64
63
  if (width) {
65
64
  attrs['data-width'] = isFinite(width) && Math.floor(width) === width ? width : width.toFixed(2);
66
65
  }
67
- if (withExtendedWidthTypes && node.attrs.widthType) {
68
- var widthType = node.attrs.widthType;
69
- return _objectSpread(_objectSpread({}, attrs), {}, {
70
- 'data-width-type': widthType || 'percentage'
71
- });
72
- }
73
- return attrs;
66
+ var widthType = node.attrs.widthType;
67
+ return _objectSpread(_objectSpread({}, attrs), {}, {
68
+ 'data-width-type': widthType || 'percentage'
69
+ });
74
70
  };
@@ -24,12 +24,5 @@ export declare const camelCaseToKebabCase: (str: string) => string;
24
24
  * When we patch adf-schema with media `toDOM` fixes we can remove this.
25
25
  */
26
26
  export declare const getAttrsFromNodeMediaSingle: (withExtendedWidthTypes: boolean, node: PMNode) => {
27
- 'data-node-type': string;
28
- 'data-layout': any;
29
- 'data-width': string;
30
- } | {
31
27
  'data-width-type': any;
32
- 'data-node-type': string;
33
- 'data-layout': any;
34
- 'data-width': string;
35
28
  };
@@ -24,12 +24,5 @@ export declare const camelCaseToKebabCase: (str: string) => string;
24
24
  * When we patch adf-schema with media `toDOM` fixes we can remove this.
25
25
  */
26
26
  export declare const getAttrsFromNodeMediaSingle: (withExtendedWidthTypes: boolean, node: PMNode) => {
27
- 'data-node-type': string;
28
- 'data-layout': any;
29
- 'data-width': string;
30
- } | {
31
27
  'data-width-type': any;
32
- 'data-node-type': string;
33
- 'data-layout': any;
34
- 'data-width': string;
35
28
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-media",
3
- "version": "1.28.0",
3
+ "version": "1.28.1",
4
4
  "description": "Media plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -64,7 +64,7 @@
64
64
  "@atlaskit/media-ui": "^25.10.0",
65
65
  "@atlaskit/media-viewer": "^48.6.0",
66
66
  "@atlaskit/platform-feature-flags": "^0.3.0",
67
- "@atlaskit/primitives": "^11.1.0",
67
+ "@atlaskit/primitives": "^12.0.0",
68
68
  "@atlaskit/textfield": "^6.4.0",
69
69
  "@atlaskit/theme": "^12.11.0",
70
70
  "@atlaskit/tokens": "^1.57.0",