@atlaskit/adf-schema 23.3.1 → 24.0.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,15 @@
1
1
  # @atlaskit/adf-schema
2
2
 
3
+ ## 24.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [`bd524db3926`](https://bitbucket.org/atlassian/atlassian-frontend/commits/bd524db3926) - ED-15380 Update fragment prosemirror-schema to match ADF schema
8
+
9
+ ### Minor Changes
10
+
11
+ - [`1f99f6b79d3`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1f99f6b79d3) - Support media inline for jira transformer and minor schema changes
12
+
3
13
  ## 23.3.1
4
14
 
5
15
  ### Patch Changes
@@ -7,7 +7,7 @@ exports.confluenceSchemaWithMediaSingle = exports.confluenceSchema = void 0;
7
7
 
8
8
  var _createSchema = require("./create-schema");
9
9
 
10
- var nodes = ['doc', 'paragraph', 'blockquote', 'codeBlock', 'panel', 'hardBreak', 'orderedList', 'bulletList', 'heading', 'mediaGroup', 'mediaSingle', 'media', 'caption', 'confluenceUnsupportedBlock', 'confluenceJiraIssue', 'expand', 'nestedExpand', 'extension', 'inlineExtension', 'bodiedExtension', 'listItem', 'mention', 'text', 'confluenceUnsupportedInline', 'media', 'rule', 'table', 'tableCell', 'tableHeader', 'tableRow', 'emoji', 'taskList', 'taskItem', 'date', 'placeholder', 'decisionList', 'decisionItem', 'layoutSection', 'layoutColumn', 'inlineCard', 'unsupportedBlock', 'unsupportedInline'];
10
+ var nodes = ['doc', 'paragraph', 'blockquote', 'codeBlock', 'panel', 'hardBreak', 'orderedList', 'bulletList', 'heading', 'mediaInline', 'mediaGroup', 'mediaSingle', 'media', 'caption', 'confluenceUnsupportedBlock', 'confluenceJiraIssue', 'expand', 'nestedExpand', 'extension', 'inlineExtension', 'bodiedExtension', 'listItem', 'mention', 'text', 'confluenceUnsupportedInline', 'media', 'rule', 'table', 'tableCell', 'tableHeader', 'tableRow', 'emoji', 'taskList', 'taskItem', 'date', 'placeholder', 'decisionList', 'decisionItem', 'layoutSection', 'layoutColumn', 'inlineCard', 'unsupportedBlock', 'unsupportedInline'];
11
11
  var marks = ['link', 'em', 'strong', 'strike', 'subsup', 'underline', 'mentionQuery', 'code', 'textColor', 'confluenceInlineComment', 'annotation', 'unsupportedMark', 'unsupportedNodeAttribute'];
12
12
  var confluenceSchema = (0, _createSchema.createSchema)({
13
13
  nodes: nodes,
@@ -56,7 +56,7 @@ function makeSchema(config) {
56
56
  }
57
57
 
58
58
  if (config.allowMedia) {
59
- nodes.push('mediaGroup', 'mediaSingle', 'media', 'caption');
59
+ nodes.push('mediaGroup', 'mediaSingle', 'media', 'caption', 'mediaInline');
60
60
  }
61
61
 
62
62
  if (config.allowTextColor) {
@@ -106,7 +106,7 @@ function isSchemaWithBlockQuotes(schema) {
106
106
  }
107
107
 
108
108
  function isSchemaWithMedia(schema) {
109
- return !!schema.nodes.mediaGroup && !!schema.nodes.media;
109
+ return !!schema.nodes.mediaGroup && !!schema.nodes.media && !!schema.nodes.mediaInline;
110
110
  }
111
111
 
112
112
  function isSchemaWithTextColor(schema) {
@@ -179,7 +179,8 @@ var externalOnlyAttributes = ['type', 'url', 'width', 'height', 'alt'];
179
179
 
180
180
  var toJSON = function toJSON(node) {
181
181
  return {
182
- attrs: Object.keys(node.attrs).filter(function (key) {
182
+ attrs: Object.keys(node.attrs) // Strip private attributes e.g. __fileName, __fileSize, __fileMimeType, etc.
183
+ .filter(function (key) {
183
184
  return !(key[0] === '_' && key[1] === '_');
184
185
  }).reduce(function (obj, key) {
185
186
  if (node.attrs.type === 'external' && externalOnlyAttributes.indexOf(key) === -1) {
@@ -135,7 +135,7 @@ var createTableSpec = function createTableSpec() {
135
135
  var tableNodeSpec = {
136
136
  content: 'tableRow+',
137
137
  attrs: attrs,
138
- marks: 'fragment unsupportedMark unsupportedNodeAttribute',
138
+ marks: 'unsupportedMark unsupportedNodeAttribute',
139
139
  tableRole: 'table',
140
140
  isolating: true,
141
141
  selectable: false,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/adf-schema",
3
- "version": "23.3.1",
3
+ "version": "24.0.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,5 @@
1
1
  import { createSchema } from './create-schema';
2
- const nodes = ['doc', 'paragraph', 'blockquote', 'codeBlock', 'panel', 'hardBreak', 'orderedList', 'bulletList', 'heading', 'mediaGroup', 'mediaSingle', 'media', 'caption', 'confluenceUnsupportedBlock', 'confluenceJiraIssue', 'expand', 'nestedExpand', 'extension', 'inlineExtension', 'bodiedExtension', 'listItem', 'mention', 'text', 'confluenceUnsupportedInline', 'media', 'rule', 'table', 'tableCell', 'tableHeader', 'tableRow', 'emoji', 'taskList', 'taskItem', 'date', 'placeholder', 'decisionList', 'decisionItem', 'layoutSection', 'layoutColumn', 'inlineCard', 'unsupportedBlock', 'unsupportedInline'];
2
+ const nodes = ['doc', 'paragraph', 'blockquote', 'codeBlock', 'panel', 'hardBreak', 'orderedList', 'bulletList', 'heading', 'mediaInline', 'mediaGroup', 'mediaSingle', 'media', 'caption', 'confluenceUnsupportedBlock', 'confluenceJiraIssue', 'expand', 'nestedExpand', 'extension', 'inlineExtension', 'bodiedExtension', 'listItem', 'mention', 'text', 'confluenceUnsupportedInline', 'media', 'rule', 'table', 'tableCell', 'tableHeader', 'tableRow', 'emoji', 'taskList', 'taskItem', 'date', 'placeholder', 'decisionList', 'decisionItem', 'layoutSection', 'layoutColumn', 'inlineCard', 'unsupportedBlock', 'unsupportedInline'];
3
3
  const marks = ['link', 'em', 'strong', 'strike', 'subsup', 'underline', 'mentionQuery', 'code', 'textColor', 'confluenceInlineComment', 'annotation', 'unsupportedMark', 'unsupportedNodeAttribute'];
4
4
  export const confluenceSchema = createSchema({
5
5
  nodes,
@@ -37,7 +37,7 @@ export default function makeSchema(config) {
37
37
  }
38
38
 
39
39
  if (config.allowMedia) {
40
- nodes.push('mediaGroup', 'mediaSingle', 'media', 'caption');
40
+ nodes.push('mediaGroup', 'mediaSingle', 'media', 'caption', 'mediaInline');
41
41
  }
42
42
 
43
43
  if (config.allowTextColor) {
@@ -78,7 +78,7 @@ export function isSchemaWithBlockQuotes(schema) {
78
78
  return !!schema.nodes.blockquote;
79
79
  }
80
80
  export function isSchemaWithMedia(schema) {
81
- return !!schema.nodes.mediaGroup && !!schema.nodes.media;
81
+ return !!schema.nodes.mediaGroup && !!schema.nodes.media && !!schema.nodes.mediaInline;
82
82
  }
83
83
  export function isSchemaWithTextColor(schema) {
84
84
  return !!schema.marks.textColor;
@@ -153,7 +153,8 @@ export const copyPrivateAttributes = (from, to, map) => {
153
153
  const optionalAttributes = ['occurrenceKey', 'width', 'height', 'url', 'alt'];
154
154
  const externalOnlyAttributes = ['type', 'url', 'width', 'height', 'alt'];
155
155
  export const toJSON = node => ({
156
- attrs: Object.keys(node.attrs).filter(key => !(key[0] === '_' && key[1] === '_')).reduce((obj, key) => {
156
+ attrs: Object.keys(node.attrs) // Strip private attributes e.g. __fileName, __fileSize, __fileMimeType, etc.
157
+ .filter(key => !(key[0] === '_' && key[1] === '_')).reduce((obj, key) => {
157
158
  if (node.attrs.type === 'external' && externalOnlyAttributes.indexOf(key) === -1) {
158
159
  return obj;
159
160
  }
@@ -103,7 +103,7 @@ const createTableSpec = () => {
103
103
  const tableNodeSpec = {
104
104
  content: 'tableRow+',
105
105
  attrs: attrs,
106
- marks: 'fragment unsupportedMark unsupportedNodeAttribute',
106
+ marks: 'unsupportedMark unsupportedNodeAttribute',
107
107
  tableRole: 'table',
108
108
  isolating: true,
109
109
  selectable: false,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/adf-schema",
3
- "version": "23.3.1",
3
+ "version": "24.0.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,5 @@
1
1
  import { createSchema } from './create-schema';
2
- var nodes = ['doc', 'paragraph', 'blockquote', 'codeBlock', 'panel', 'hardBreak', 'orderedList', 'bulletList', 'heading', 'mediaGroup', 'mediaSingle', 'media', 'caption', 'confluenceUnsupportedBlock', 'confluenceJiraIssue', 'expand', 'nestedExpand', 'extension', 'inlineExtension', 'bodiedExtension', 'listItem', 'mention', 'text', 'confluenceUnsupportedInline', 'media', 'rule', 'table', 'tableCell', 'tableHeader', 'tableRow', 'emoji', 'taskList', 'taskItem', 'date', 'placeholder', 'decisionList', 'decisionItem', 'layoutSection', 'layoutColumn', 'inlineCard', 'unsupportedBlock', 'unsupportedInline'];
2
+ var nodes = ['doc', 'paragraph', 'blockquote', 'codeBlock', 'panel', 'hardBreak', 'orderedList', 'bulletList', 'heading', 'mediaInline', 'mediaGroup', 'mediaSingle', 'media', 'caption', 'confluenceUnsupportedBlock', 'confluenceJiraIssue', 'expand', 'nestedExpand', 'extension', 'inlineExtension', 'bodiedExtension', 'listItem', 'mention', 'text', 'confluenceUnsupportedInline', 'media', 'rule', 'table', 'tableCell', 'tableHeader', 'tableRow', 'emoji', 'taskList', 'taskItem', 'date', 'placeholder', 'decisionList', 'decisionItem', 'layoutSection', 'layoutColumn', 'inlineCard', 'unsupportedBlock', 'unsupportedInline'];
3
3
  var marks = ['link', 'em', 'strong', 'strike', 'subsup', 'underline', 'mentionQuery', 'code', 'textColor', 'confluenceInlineComment', 'annotation', 'unsupportedMark', 'unsupportedNodeAttribute'];
4
4
  export var confluenceSchema = createSchema({
5
5
  nodes: nodes,
@@ -37,7 +37,7 @@ export default function makeSchema(config) {
37
37
  }
38
38
 
39
39
  if (config.allowMedia) {
40
- nodes.push('mediaGroup', 'mediaSingle', 'media', 'caption');
40
+ nodes.push('mediaGroup', 'mediaSingle', 'media', 'caption', 'mediaInline');
41
41
  }
42
42
 
43
43
  if (config.allowTextColor) {
@@ -78,7 +78,7 @@ export function isSchemaWithBlockQuotes(schema) {
78
78
  return !!schema.nodes.blockquote;
79
79
  }
80
80
  export function isSchemaWithMedia(schema) {
81
- return !!schema.nodes.mediaGroup && !!schema.nodes.media;
81
+ return !!schema.nodes.mediaGroup && !!schema.nodes.media && !!schema.nodes.mediaInline;
82
82
  }
83
83
  export function isSchemaWithTextColor(schema) {
84
84
  return !!schema.marks.textColor;
@@ -159,7 +159,8 @@ var optionalAttributes = ['occurrenceKey', 'width', 'height', 'url', 'alt'];
159
159
  var externalOnlyAttributes = ['type', 'url', 'width', 'height', 'alt'];
160
160
  export var toJSON = function toJSON(node) {
161
161
  return {
162
- attrs: Object.keys(node.attrs).filter(function (key) {
162
+ attrs: Object.keys(node.attrs) // Strip private attributes e.g. __fileName, __fileSize, __fileMimeType, etc.
163
+ .filter(function (key) {
163
164
  return !(key[0] === '_' && key[1] === '_');
164
165
  }).reduce(function (obj, key) {
165
166
  if (node.attrs.type === 'external' && externalOnlyAttributes.indexOf(key) === -1) {
@@ -107,7 +107,7 @@ var createTableSpec = function createTableSpec() {
107
107
  var tableNodeSpec = {
108
108
  content: 'tableRow+',
109
109
  attrs: attrs,
110
- marks: 'fragment unsupportedMark unsupportedNodeAttribute',
110
+ marks: 'unsupportedMark unsupportedNodeAttribute',
111
111
  tableRole: 'table',
112
112
  isolating: true,
113
113
  selectable: false,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/adf-schema",
3
- "version": "23.3.1",
3
+ "version": "24.0.0",
4
4
  "sideEffects": false
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/adf-schema",
3
- "version": "23.3.1",
3
+ "version": "24.0.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/"
@@ -52,7 +52,7 @@
52
52
  },
53
53
  "devDependencies": {
54
54
  "@atlaskit/adf-utils": "^17.1.0",
55
- "@atlaskit/editor-json-transformer": "^8.7.0",
55
+ "@atlaskit/editor-json-transformer": "^8.8.0",
56
56
  "@atlaskit/editor-test-helpers": "^17.1.0",
57
57
  "@atlaskit/json-schema-generator": "^3.2.0",
58
58
  "@atlassian/adf-sample": "^1.1.0",