@atlaskit/adf-schema 36.8.4 → 36.9.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,17 @@
1
1
  # @atlaskit/adf-schema
2
2
 
3
+ ## 36.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - c8ecca1: Generate new uuid to support copy paste in mentionNode
8
+
9
+ ## 36.8.5
10
+
11
+ ### Patch Changes
12
+
13
+ - 669a895: Add anyof field to json marks in DSL transformer
14
+
3
15
  ## 36.8.4
4
16
 
5
17
  ### Patch Changes
@@ -10,7 +10,7 @@ var _border = require("../marks/border");
10
10
  var _link = require("../marks/link");
11
11
  var media = exports.media = (0, _adfSchemaGenerator.adfNode)('media').define({
12
12
  selectable: true,
13
- marks: [_link.link, _border.border, _annotation.annotation],
13
+ marks: [_link.link, _annotation.annotation, _border.border],
14
14
  attrs: {
15
15
  type: {
16
16
  type: 'enum',
@@ -13,7 +13,7 @@ var _media = require("./media");
13
13
  var mediaInline = exports.mediaInline = (0, _adfSchemaGenerator.adfNode)('mediaInline').define({
14
14
  selectable: true,
15
15
  atom: false,
16
- marks: [_link.link, _border.border, _annotation.annotation],
16
+ marks: [_link.link, _annotation.annotation, _border.border],
17
17
  attrs: {
18
18
  data: {
19
19
  type: 'object',
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.toJSON = exports.mention = exports.USER_TYPES = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
+ var _utils = require("../../utils");
9
10
  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; }
10
11
  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; }
11
12
  var USER_TYPES = exports.USER_TYPES = /*#__PURE__*/function (USER_TYPES) {
@@ -46,7 +47,7 @@ var mention = exports.mention = {
46
47
  id: dom.getAttribute('data-mention-id') || mention.attrs.id.default,
47
48
  text: dom.textContent || mention.attrs.text.default,
48
49
  accessLevel: dom.getAttribute('data-access-level') || mention.attrs.accessLevel.default,
49
- localId: dom.getAttribute('data-local-id') || mention.attrs.localId.default
50
+ localId: _utils.uuid.generate()
50
51
  };
51
52
  var userType = dom.getAttribute('data-user-type');
52
53
  if (USER_TYPES[userType]) {
@@ -4,7 +4,7 @@ import { border } from '../marks/border';
4
4
  import { link } from '../marks/link';
5
5
  export const media = adfNode('media').define({
6
6
  selectable: true,
7
- marks: [link, border, annotation],
7
+ marks: [link, annotation, border],
8
8
  attrs: {
9
9
  type: {
10
10
  type: 'enum',
@@ -7,7 +7,7 @@ import { media } from './media';
7
7
  export const mediaInline = adfNode('mediaInline').define({
8
8
  selectable: true,
9
9
  atom: false,
10
- marks: [link, border, annotation],
10
+ marks: [link, annotation, border],
11
11
  attrs: {
12
12
  data: {
13
13
  type: 'object',
@@ -1,3 +1,4 @@
1
+ import { uuid } from '../../utils';
1
2
  export let USER_TYPES = /*#__PURE__*/function (USER_TYPES) {
2
3
  USER_TYPES["DEFAULT"] = "DEFAULT";
3
4
  USER_TYPES["SPECIAL"] = "SPECIAL";
@@ -38,7 +39,7 @@ export const mention = {
38
39
  id: dom.getAttribute('data-mention-id') || mention.attrs.id.default,
39
40
  text: dom.textContent || mention.attrs.text.default,
40
41
  accessLevel: dom.getAttribute('data-access-level') || mention.attrs.accessLevel.default,
41
- localId: dom.getAttribute('data-local-id') || mention.attrs.localId.default
42
+ localId: uuid.generate()
42
43
  };
43
44
  const userType = dom.getAttribute('data-user-type');
44
45
  if (USER_TYPES[userType]) {
@@ -4,7 +4,7 @@ import { border } from '../marks/border';
4
4
  import { link } from '../marks/link';
5
5
  export var media = adfNode('media').define({
6
6
  selectable: true,
7
- marks: [link, border, annotation],
7
+ marks: [link, annotation, border],
8
8
  attrs: {
9
9
  type: {
10
10
  type: 'enum',
@@ -7,7 +7,7 @@ import { media } from './media';
7
7
  export var mediaInline = adfNode('mediaInline').define({
8
8
  selectable: true,
9
9
  atom: false,
10
- marks: [link, border, annotation],
10
+ marks: [link, annotation, border],
11
11
  attrs: {
12
12
  data: {
13
13
  type: 'object',
@@ -1,6 +1,7 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  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; }
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
+ import { uuid } from '../../utils';
4
5
  export var USER_TYPES = /*#__PURE__*/function (USER_TYPES) {
5
6
  USER_TYPES["DEFAULT"] = "DEFAULT";
6
7
  USER_TYPES["SPECIAL"] = "SPECIAL";
@@ -41,7 +42,7 @@ export var mention = {
41
42
  id: dom.getAttribute('data-mention-id') || mention.attrs.id.default,
42
43
  text: dom.textContent || mention.attrs.text.default,
43
44
  accessLevel: dom.getAttribute('data-access-level') || mention.attrs.accessLevel.default,
44
- localId: dom.getAttribute('data-local-id') || mention.attrs.localId.default
45
+ localId: uuid.generate()
45
46
  };
46
47
  var userType = dom.getAttribute('data-user-type');
47
48
  if (USER_TYPES[userType]) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/adf-schema",
3
- "version": "36.8.4",
3
+ "version": "36.9.0",
4
4
  "description": "Shared package that contains the ADF-schema (json) and ProseMirror node/mark specs",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -44,7 +44,7 @@
44
44
  },
45
45
  "devDependencies": {
46
46
  "@atlassian/adf-schema-json": "^1.15.0",
47
- "@atlaskit/adf-schema-generator": "^1.7.3",
47
+ "@atlaskit/adf-schema-generator": "^1.7.4",
48
48
  "@babel/cli": "^7.22.9",
49
49
  "@babel/core": "^7.22.9",
50
50
  "@babel/plugin-proposal-class-properties": "^7.18.6",
@@ -43,13 +43,13 @@ A number of nodes have `marks` defined, yet the array is empty. Assuming this is
43
43
  .bodiedExtension_node.properties.marks, .codeBlock_node.properties.marks, .expand_node.properties.marks, .heading_node.properties.marks, .inlineExtension_node.properties.marks, .text_node.properties.marks) else . end)'
44
44
  ```
45
45
 
46
- Delete all subfields except for marks, items, type and properties. Content objects are also deleted. Inline is also deleted, as it is a content object for paragraph.
46
+ Delete all subfields except for marks, anyOf, items, type and properties. Content objects are also deleted. Inline is also deleted, as it is a content object for paragraph.
47
47
 
48
48
  A number of nodes have `marks` defined, yet the array is empty. Assuming this is redundant, I've removed them.
49
49
 
50
50
  ```sh
51
51
  cat packages/adf-schema/json-schema/v1/full.json | jq 'walk(if type == "object" then del(
52
- .content, .text, .attrs, .version, .required, .additionalProperties, .allOf, .anyOf, .minItems,
52
+ .content, .text, .attrs, .version, .required, .additionalProperties, .allOf, .minItems,
53
53
  .block_content, .nestedExpand_content, .non_nestable_block_content, .table_cell_content, .inline_node,
54
54
  .bodiedExtension_node.properties.marks, .codeBlock_node.properties.marks, .expand_node.properties.marks, .heading_node.properties.marks, .inlineExtension_node.properties.marks, .text_node.properties.marks, .extension_node.properties.marks, .paragraph_node.properties.marks) else . end)'
55
55
  ```
@@ -239,7 +239,19 @@ const jsonWithTypes = {
239
239
  },
240
240
  marks: {
241
241
  type: 'array',
242
- items: {},
242
+ items: {
243
+ anyOf: [
244
+ {
245
+ $ref: '#/definitions/link_mark',
246
+ },
247
+ {
248
+ $ref: '#/definitions/annotation_mark',
249
+ },
250
+ {
251
+ $ref: '#/definitions/border_mark',
252
+ },
253
+ ],
254
+ },
243
255
  },
244
256
  },
245
257
  },
@@ -251,7 +263,19 @@ const jsonWithTypes = {
251
263
  },
252
264
  marks: {
253
265
  type: 'array',
254
- items: {},
266
+ items: {
267
+ anyOf: [
268
+ {
269
+ $ref: '#/definitions/link_mark',
270
+ },
271
+ {
272
+ $ref: '#/definitions/annotation_mark',
273
+ },
274
+ {
275
+ $ref: '#/definitions/border_mark',
276
+ },
277
+ ],
278
+ },
255
279
  },
256
280
  },
257
281
  },