@atlaskit/renderer 109.24.1 → 109.25.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @atlaskit/renderer
2
2
 
3
+ ## 109.25.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#94548](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/94548)
8
+ [`9eacc753e6eb`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9eacc753e6eb) - -
9
+ Update applyAnnotation action to return annotation target nodeType
10
+ - Define MEDIA_CONTAINER for media node
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies
15
+
16
+ ## 109.24.2
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies
21
+
3
22
  ## 109.24.1
4
23
 
5
24
  ### Patch Changes
@@ -16,6 +16,8 @@ var _transform = require("@atlaskit/editor-prosemirror/transform");
16
16
  var _steps = require("../steps");
17
17
  var _analytics = require("@atlaskit/editor-common/analytics");
18
18
  var _matchesUtils = require("./matches-utils");
19
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
20
+ 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) { (0, _defineProperty2.default)(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; }
19
21
  var RendererActions = exports.default = /*#__PURE__*/function () {
20
22
  // Any kind of refence is allowed
21
23
 
@@ -227,6 +229,7 @@ var RendererActions = exports.default = /*#__PURE__*/function () {
227
229
  var annotationId = annotation.annotationId,
228
230
  annotationType = annotation.annotationType;
229
231
  var step;
232
+ var targetNodeType;
230
233
  var beforeNodePos = isCommentsOnMediaBugFixEnabled ?
231
234
  // As part of fix for RAP, `from` points to the position right before media node
232
235
  // hence, -1 is not needed
@@ -236,11 +239,13 @@ var RendererActions = exports.default = /*#__PURE__*/function () {
236
239
  Math.max(from - 1, 0);
237
240
  var possibleNode = this.doc.nodeAt(beforeNodePos);
238
241
  if ((possibleNode === null || possibleNode === void 0 ? void 0 : possibleNode.type.name) === 'media') {
242
+ targetNodeType = 'media';
239
243
  step = new _transform.AddNodeMarkStep(beforeNodePos, this.schema.marks.annotation.create({
240
244
  id: annotationId,
241
245
  type: annotationType
242
246
  }));
243
247
  } else {
248
+ targetNodeType = 'text';
244
249
  step = (0, _steps.createAnnotationStep)(from, to, {
245
250
  annotationId: annotationId,
246
251
  annotationType: annotationType,
@@ -258,14 +263,16 @@ var RendererActions = exports.default = /*#__PURE__*/function () {
258
263
  numMatches = _getIndexMatch.numMatches,
259
264
  matchIndex = _getIndexMatch.matchIndex,
260
265
  blockNodePos = _getIndexMatch.blockNodePos;
261
- return {
266
+ return _objectSpread({
262
267
  step: step,
263
268
  doc: this.transformer.encode(doc),
264
269
  originalSelection: originalSelection,
265
270
  numMatches: numMatches,
266
271
  matchIndex: matchIndex,
267
272
  pos: blockNodePos
268
- };
273
+ }, isCommentsOnMediaBugFixEnabled && {
274
+ targetNodeType: targetNodeType
275
+ });
269
276
  }
270
277
  }, {
271
278
  key: "generateAnnotationIndexMatch",
@@ -56,7 +56,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
56
56
  var NORMAL_SEVERITY_THRESHOLD = exports.NORMAL_SEVERITY_THRESHOLD = 2000;
57
57
  var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
58
58
  var packageName = "@atlaskit/renderer";
59
- var packageVersion = "109.24.1";
59
+ var packageVersion = "109.25.0";
60
60
  var defaultNodeComponents = exports.defaultNodeComponents = _nodes.nodeToReact;
61
61
  var Renderer = exports.Renderer = /*#__PURE__*/function (_PureComponent) {
62
62
  (0, _inherits2.default)(Renderer, _PureComponent);
@@ -205,6 +205,7 @@ export default class RendererActions {
205
205
  annotationType
206
206
  } = annotation;
207
207
  let step;
208
+ let targetNodeType;
208
209
  const beforeNodePos = isCommentsOnMediaBugFixEnabled ?
209
210
  // As part of fix for RAP, `from` points to the position right before media node
210
211
  // hence, -1 is not needed
@@ -214,11 +215,13 @@ export default class RendererActions {
214
215
  Math.max(from - 1, 0);
215
216
  const possibleNode = this.doc.nodeAt(beforeNodePos);
216
217
  if ((possibleNode === null || possibleNode === void 0 ? void 0 : possibleNode.type.name) === 'media') {
218
+ targetNodeType = 'media';
217
219
  step = new AddNodeMarkStep(beforeNodePos, this.schema.marks.annotation.create({
218
220
  id: annotationId,
219
221
  type: annotationType
220
222
  }));
221
223
  } else {
224
+ targetNodeType = 'text';
222
225
  step = createAnnotationStep(from, to, {
223
226
  annotationId,
224
227
  annotationType,
@@ -244,7 +247,10 @@ export default class RendererActions {
244
247
  originalSelection,
245
248
  numMatches,
246
249
  matchIndex,
247
- pos: blockNodePos
250
+ pos: blockNodePos,
251
+ ...(isCommentsOnMediaBugFixEnabled && {
252
+ targetNodeType
253
+ })
248
254
  };
249
255
  }
250
256
  generateAnnotationIndexMatch(pos) {
@@ -37,7 +37,7 @@ import { nodeToReact } from '../../react/nodes';
37
37
  export const NORMAL_SEVERITY_THRESHOLD = 2000;
38
38
  export const DEGRADED_SEVERITY_THRESHOLD = 3000;
39
39
  const packageName = "@atlaskit/renderer";
40
- const packageVersion = "109.24.1";
40
+ const packageVersion = "109.25.0";
41
41
  export const defaultNodeComponents = nodeToReact;
42
42
  export class Renderer extends PureComponent {
43
43
  constructor(props) {
@@ -2,6 +2,8 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
2
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
3
  import _createClass from "@babel/runtime/helpers/createClass";
4
4
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
5
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
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; }
5
7
  import { JSONTransformer } from '@atlaskit/editor-json-transformer';
6
8
  import { canApplyAnnotationOnRange, getAnnotationIdsFromRange } from '@atlaskit/editor-common/utils';
7
9
  import { AnnotationTypes } from '@atlaskit/adf-schema';
@@ -220,6 +222,7 @@ var RendererActions = /*#__PURE__*/function () {
220
222
  var annotationId = annotation.annotationId,
221
223
  annotationType = annotation.annotationType;
222
224
  var step;
225
+ var targetNodeType;
223
226
  var beforeNodePos = isCommentsOnMediaBugFixEnabled ?
224
227
  // As part of fix for RAP, `from` points to the position right before media node
225
228
  // hence, -1 is not needed
@@ -229,11 +232,13 @@ var RendererActions = /*#__PURE__*/function () {
229
232
  Math.max(from - 1, 0);
230
233
  var possibleNode = this.doc.nodeAt(beforeNodePos);
231
234
  if ((possibleNode === null || possibleNode === void 0 ? void 0 : possibleNode.type.name) === 'media') {
235
+ targetNodeType = 'media';
232
236
  step = new AddNodeMarkStep(beforeNodePos, this.schema.marks.annotation.create({
233
237
  id: annotationId,
234
238
  type: annotationType
235
239
  }));
236
240
  } else {
241
+ targetNodeType = 'text';
237
242
  step = createAnnotationStep(from, to, {
238
243
  annotationId: annotationId,
239
244
  annotationType: annotationType,
@@ -251,14 +256,16 @@ var RendererActions = /*#__PURE__*/function () {
251
256
  numMatches = _getIndexMatch.numMatches,
252
257
  matchIndex = _getIndexMatch.matchIndex,
253
258
  blockNodePos = _getIndexMatch.blockNodePos;
254
- return {
259
+ return _objectSpread({
255
260
  step: step,
256
261
  doc: this.transformer.encode(doc),
257
262
  originalSelection: originalSelection,
258
263
  numMatches: numMatches,
259
264
  matchIndex: matchIndex,
260
265
  pos: blockNodePos
261
- };
266
+ }, isCommentsOnMediaBugFixEnabled && {
267
+ targetNodeType: targetNodeType
268
+ });
262
269
  }
263
270
  }, {
264
271
  key: "generateAnnotationIndexMatch",
@@ -47,7 +47,7 @@ import { nodeToReact } from '../../react/nodes';
47
47
  export var NORMAL_SEVERITY_THRESHOLD = 2000;
48
48
  export var DEGRADED_SEVERITY_THRESHOLD = 3000;
49
49
  var packageName = "@atlaskit/renderer";
50
- var packageVersion = "109.24.1";
50
+ var packageVersion = "109.25.0";
51
51
  export var defaultNodeComponents = nodeToReact;
52
52
  export var Renderer = /*#__PURE__*/function (_PureComponent) {
53
53
  _inherits(Renderer, _PureComponent);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/renderer",
3
- "version": "109.24.1",
3
+ "version": "109.25.0",
4
4
  "description": "Renderer component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -31,20 +31,20 @@
31
31
  "@atlaskit/analytics-next": "^9.3.0",
32
32
  "@atlaskit/button": "^17.14.0",
33
33
  "@atlaskit/code": "^15.1.0",
34
- "@atlaskit/editor-common": "^79.0.0",
34
+ "@atlaskit/editor-common": "^79.1.0",
35
35
  "@atlaskit/editor-json-transformer": "^8.11.0",
36
36
  "@atlaskit/editor-palette": "1.6.0",
37
37
  "@atlaskit/editor-prosemirror": "4.0.0",
38
38
  "@atlaskit/editor-shared-styles": "^2.10.0",
39
39
  "@atlaskit/emoji": "^67.6.0",
40
40
  "@atlaskit/icon": "^22.1.0",
41
- "@atlaskit/link-datasource": "^1.31.0",
41
+ "@atlaskit/link-datasource": "^2.0.0",
42
42
  "@atlaskit/media-card": "^77.11.0",
43
43
  "@atlaskit/media-client": "^26.3.0",
44
44
  "@atlaskit/media-client-react": "^2.0.0",
45
45
  "@atlaskit/media-common": "^11.2.0",
46
46
  "@atlaskit/media-filmstrip": "^47.0.0",
47
- "@atlaskit/media-ui": "^25.9.0",
47
+ "@atlaskit/media-ui": "^25.10.0",
48
48
  "@atlaskit/media-viewer": "^48.5.0",
49
49
  "@atlaskit/platform-feature-flags": "^0.2.0",
50
50
  "@atlaskit/smart-card": "^26.59.0",