@atlaskit/adf-schema 29.1.2 → 29.2.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,11 @@
1
1
  # @atlaskit/adf-schema
2
2
 
3
+ ## 29.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - e5770f4: Promote table width attribute to full schema
8
+
3
9
  ## 29.1.2
4
10
 
5
11
  ### Patch Changes
@@ -25,7 +25,6 @@ var getSchemaBasedOnStage = (0, _memoizeOne.default)(function () {
25
25
  if (stage === 'stage0') {
26
26
  defaultSchemaConfig.customNodeSpecs = {
27
27
  layoutSection: _nodes.layoutSectionWithSingleColumn,
28
- table: _nodes.tableWithCustomWidth,
29
28
  mediaSingle: _nodes.mediaSingleFull
30
29
  };
31
30
  }
@@ -159,7 +159,6 @@ exports.tableBackgroundColorNames = tableBackgroundColorNames;
159
159
 
160
160
  // TODO: Fix any, potential issue. ED-5048
161
161
  var createTableSpec = function createTableSpec() {
162
- var allowCustomWidth = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
163
162
  var attrs = {
164
163
  isNumberColumnEnabled: {
165
164
  default: false
@@ -172,16 +171,14 @@ var createTableSpec = function createTableSpec() {
172
171
  },
173
172
  localId: {
174
173
  default: ''
175
- }
176
- };
177
- var finalAttrs = allowCustomWidth ? _objectSpread(_objectSpread({}, attrs), {}, {
174
+ },
178
175
  width: {
179
176
  default: null
180
177
  }
181
- }) : attrs;
178
+ };
182
179
  var tableNodeSpec = {
183
180
  content: 'tableRow+',
184
- attrs: finalAttrs,
181
+ attrs: attrs,
185
182
  marks: 'unsupportedMark unsupportedNodeAttribute',
186
183
  tableRole: 'table',
187
184
  isolating: true,
@@ -218,9 +215,13 @@ var createTableSpec = function createTableSpec() {
218
215
  };
219
216
  return tableNodeSpec;
220
217
  };
221
- var table = createTableSpec(false);
218
+
219
+ // TODO: assuming breaking changes aren't allowed, so retaining both exports
220
+ /** Includes table width attribute */
221
+ var table = createTableSpec();
222
+ /** @deprecated Do not use, instead use the regular `table` export */
222
223
  exports.table = table;
223
- var tableWithCustomWidth = createTableSpec(true);
224
+ var tableWithCustomWidth = createTableSpec();
224
225
  exports.tableWithCustomWidth = tableWithCustomWidth;
225
226
  var shouldIncludeAttribute = function shouldIncludeAttribute(key, value) {
226
227
  return !key.startsWith('__') && (key !== 'localId' || !!value);
@@ -1,5 +1,5 @@
1
1
  import memoizeOne from 'memoize-one';
2
- import { mediaSingleFull, layoutSectionWithSingleColumn, tableWithCustomWidth } from './nodes';
2
+ import { mediaSingleFull, layoutSectionWithSingleColumn } from './nodes';
3
3
  import { createSchema } from './create-schema';
4
4
  const getDefaultSchemaConfig = () => {
5
5
  let defaultSchemaConfig = {
@@ -16,7 +16,6 @@ export const getSchemaBasedOnStage = memoizeOne((stage = 'final') => {
16
16
  if (stage === 'stage0') {
17
17
  defaultSchemaConfig.customNodeSpecs = {
18
18
  layoutSection: layoutSectionWithSingleColumn,
19
- table: tableWithCustomWidth,
20
19
  mediaSingle: mediaSingleFull
21
20
  };
22
21
  }
@@ -135,7 +135,7 @@ export const tableBackgroundColorNames = new Map();
135
135
  */
136
136
 
137
137
  // TODO: Fix any, potential issue. ED-5048
138
- const createTableSpec = (allowCustomWidth = false) => {
138
+ const createTableSpec = () => {
139
139
  const attrs = {
140
140
  isNumberColumnEnabled: {
141
141
  default: false
@@ -148,17 +148,14 @@ const createTableSpec = (allowCustomWidth = false) => {
148
148
  },
149
149
  localId: {
150
150
  default: ''
151
- }
152
- };
153
- const finalAttrs = allowCustomWidth ? {
154
- ...attrs,
151
+ },
155
152
  width: {
156
153
  default: null
157
154
  }
158
- } : attrs;
155
+ };
159
156
  const tableNodeSpec = {
160
157
  content: 'tableRow+',
161
- attrs: finalAttrs,
158
+ attrs: attrs,
162
159
  marks: 'unsupportedMark unsupportedNodeAttribute',
163
160
  tableRole: 'table',
164
161
  isolating: true,
@@ -195,8 +192,12 @@ const createTableSpec = (allowCustomWidth = false) => {
195
192
  };
196
193
  return tableNodeSpec;
197
194
  };
198
- export const table = createTableSpec(false);
199
- export const tableWithCustomWidth = createTableSpec(true);
195
+
196
+ // TODO: assuming breaking changes aren't allowed, so retaining both exports
197
+ /** Includes table width attribute */
198
+ export const table = createTableSpec();
199
+ /** @deprecated Do not use, instead use the regular `table` export */
200
+ export const tableWithCustomWidth = createTableSpec();
200
201
  const shouldIncludeAttribute = (key, value) => !key.startsWith('__') && (key !== 'localId' || !!value);
201
202
  export const tableToJSON = node => ({
202
203
  attrs: Object.keys(node.attrs).filter(key => shouldIncludeAttribute(key, node.attrs[key])).reduce((obj, key) => {
@@ -1,5 +1,5 @@
1
1
  import memoizeOne from 'memoize-one';
2
- import { mediaSingleFull, layoutSectionWithSingleColumn, tableWithCustomWidth } from './nodes';
2
+ import { mediaSingleFull, layoutSectionWithSingleColumn } from './nodes';
3
3
  import { createSchema } from './create-schema';
4
4
  var getDefaultSchemaConfig = function getDefaultSchemaConfig() {
5
5
  var defaultSchemaConfig = {
@@ -17,7 +17,6 @@ export var getSchemaBasedOnStage = memoizeOne(function () {
17
17
  if (stage === 'stage0') {
18
18
  defaultSchemaConfig.customNodeSpecs = {
19
19
  layoutSection: layoutSectionWithSingleColumn,
20
- table: tableWithCustomWidth,
21
20
  mediaSingle: mediaSingleFull
22
21
  };
23
22
  }
@@ -142,7 +142,6 @@ export var tableBackgroundColorNames = new Map();
142
142
 
143
143
  // TODO: Fix any, potential issue. ED-5048
144
144
  var createTableSpec = function createTableSpec() {
145
- var allowCustomWidth = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
146
145
  var attrs = {
147
146
  isNumberColumnEnabled: {
148
147
  default: false
@@ -155,16 +154,14 @@ var createTableSpec = function createTableSpec() {
155
154
  },
156
155
  localId: {
157
156
  default: ''
158
- }
159
- };
160
- var finalAttrs = allowCustomWidth ? _objectSpread(_objectSpread({}, attrs), {}, {
157
+ },
161
158
  width: {
162
159
  default: null
163
160
  }
164
- }) : attrs;
161
+ };
165
162
  var tableNodeSpec = {
166
163
  content: 'tableRow+',
167
- attrs: finalAttrs,
164
+ attrs: attrs,
168
165
  marks: 'unsupportedMark unsupportedNodeAttribute',
169
166
  tableRole: 'table',
170
167
  isolating: true,
@@ -201,8 +198,12 @@ var createTableSpec = function createTableSpec() {
201
198
  };
202
199
  return tableNodeSpec;
203
200
  };
204
- export var table = createTableSpec(false);
205
- export var tableWithCustomWidth = createTableSpec(true);
201
+
202
+ // TODO: assuming breaking changes aren't allowed, so retaining both exports
203
+ /** Includes table width attribute */
204
+ export var table = createTableSpec();
205
+ /** @deprecated Do not use, instead use the regular `table` export */
206
+ export var tableWithCustomWidth = createTableSpec();
206
207
  var shouldIncludeAttribute = function shouldIncludeAttribute(key, value) {
207
208
  return !key.startsWith('__') && (key !== 'localId' || !!value);
208
209
  };
@@ -2045,6 +2045,9 @@
2045
2045
  "localId": {
2046
2046
  "type": "string",
2047
2047
  "minLength": 1
2048
+ },
2049
+ "width": {
2050
+ "type": "number"
2048
2051
  }
2049
2052
  },
2050
2053
  "additionalProperties": false
@@ -55,9 +55,6 @@ export interface TableAttributes {
55
55
  * @minLength 1
56
56
  */
57
57
  localId?: string;
58
- /**
59
- * @stage 0
60
- */
61
58
  width?: number;
62
59
  }
63
60
  /**
@@ -101,7 +98,9 @@ export interface TableHeader {
101
98
  attrs?: CellAttributes;
102
99
  content: TableCellContent;
103
100
  }
101
+ /** Includes table width attribute */
104
102
  export declare const table: NodeSpec;
103
+ /** @deprecated Do not use, instead use the regular `table` export */
105
104
  export declare const tableWithCustomWidth: NodeSpec;
106
105
  export declare const tableToJSON: (node: PmNode) => {
107
106
  attrs: import("prosemirror-model").Attrs;
@@ -2045,6 +2045,9 @@
2045
2045
  "localId": {
2046
2046
  "type": "string",
2047
2047
  "minLength": 1
2048
+ },
2049
+ "width": {
2050
+ "type": "number"
2048
2051
  }
2049
2052
  },
2050
2053
  "additionalProperties": false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/adf-schema",
3
- "version": "29.1.2",
3
+ "version": "29.2.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/"