@manuscripts/transform 2.1.1-LEAN-3336-13 → 2.1.1-LEAN-3336-14

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.
@@ -15,7 +15,7 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.tableHeader = exports.tableCell = exports.tableRow = exports.table = exports.tableNodes = exports.createTableNodes = void 0;
18
+ exports.tableHeader = exports.tableCell = exports.tableRow = exports.table = exports.tableNodes = void 0;
19
19
  const table_cell_styles_1 = require("../../lib/table-cell-styles");
20
20
  function getCellAttrs(dom, extraAttrs) {
21
21
  if (typeof dom === 'string') {
@@ -77,6 +77,13 @@ function createTableNodes(options) {
77
77
  content: 'table_row+',
78
78
  tableRole: 'table',
79
79
  isolating: true,
80
+ attrs: {
81
+ id: { default: '' },
82
+ dataTracked: { default: null },
83
+ comments: { default: null },
84
+ headerRows: { default: 1 },
85
+ footerRows: { default: 1 },
86
+ },
80
87
  group: options.tableGroup,
81
88
  parseDOM: [
82
89
  {
@@ -137,7 +144,6 @@ function createTableNodes(options) {
137
144
  },
138
145
  };
139
146
  }
140
- exports.createTableNodes = createTableNodes;
141
147
  const tableOptions = {
142
148
  tableGroup: 'block',
143
149
  cellContent: 'inline*',
@@ -165,14 +171,6 @@ const tableOptions = {
165
171
  }
166
172
  },
167
173
  },
168
- class: {
169
- default: null,
170
- setDOMAttr(value, attrs) {
171
- if (value) {
172
- attrs['class'] = value;
173
- }
174
- },
175
- },
176
174
  valign: {
177
175
  default: null,
178
176
  getFromDOM(dom) {
@@ -220,7 +218,7 @@ const tableOptions = {
220
218
  },
221
219
  };
222
220
  exports.tableNodes = createTableNodes(tableOptions);
223
- exports.table = Object.assign(Object.assign({}, exports.tableNodes.table), { attrs: Object.assign(Object.assign({}, exports.tableNodes.table.attrs), { id: { default: '' }, dataTracked: { default: null }, comments: { default: null }, headerRows: { default: 1 }, footerRows: { default: 1 } }) });
221
+ exports.table = exports.tableNodes.table;
224
222
  exports.tableRow = exports.tableNodes.table_row;
225
223
  exports.tableCell = exports.tableNodes.table_cell;
226
224
  exports.tableHeader = exports.tableNodes.table_header;
@@ -574,12 +574,14 @@ class Decoder {
574
574
  const figcaption = this.getFigcaption(model);
575
575
  const comments = this.createCommentNodes(model);
576
576
  comments.forEach((c) => this.comments.set(c.attrs.id, c));
577
- const content = tableElementFooter
578
- ? [table, tableElementFooter, figcaption]
579
- : [table, figcaption];
577
+ const content = [table];
580
578
  if (tableColGroup) {
581
579
  content.unshift(tableColGroup);
582
580
  }
581
+ if (tableElementFooter) {
582
+ content.push(tableElementFooter);
583
+ }
584
+ content.push(figcaption);
583
585
  if (model.listingID) {
584
586
  const listing = this.createListing(model.listingID);
585
587
  content.push(listing);
@@ -59,7 +59,7 @@ function setCellAttrs(node, extraAttrs) {
59
59
  }
60
60
  return attrs;
61
61
  }
62
- export function createTableNodes(options) {
62
+ function createTableNodes(options) {
63
63
  const extraAttrs = options.cellAttributes || {};
64
64
  const cellAttrs = {
65
65
  colspan: { default: 1 },
@@ -74,6 +74,13 @@ export function createTableNodes(options) {
74
74
  content: 'table_row+',
75
75
  tableRole: 'table',
76
76
  isolating: true,
77
+ attrs: {
78
+ id: { default: '' },
79
+ dataTracked: { default: null },
80
+ comments: { default: null },
81
+ headerRows: { default: 1 },
82
+ footerRows: { default: 1 },
83
+ },
77
84
  group: options.tableGroup,
78
85
  parseDOM: [
79
86
  {
@@ -161,14 +168,6 @@ const tableOptions = {
161
168
  }
162
169
  },
163
170
  },
164
- class: {
165
- default: null,
166
- setDOMAttr(value, attrs) {
167
- if (value) {
168
- attrs['class'] = value;
169
- }
170
- },
171
- },
172
171
  valign: {
173
172
  default: null,
174
173
  getFromDOM(dom) {
@@ -216,7 +215,7 @@ const tableOptions = {
216
215
  },
217
216
  };
218
217
  export const tableNodes = createTableNodes(tableOptions);
219
- export const table = Object.assign(Object.assign({}, tableNodes.table), { attrs: Object.assign(Object.assign({}, tableNodes.table.attrs), { id: { default: '' }, dataTracked: { default: null }, comments: { default: null }, headerRows: { default: 1 }, footerRows: { default: 1 } }) });
218
+ export const table = tableNodes.table;
220
219
  export const tableRow = tableNodes.table_row;
221
220
  export const tableCell = tableNodes.table_cell;
222
221
  export const tableHeader = tableNodes.table_header;
@@ -565,12 +565,14 @@ export class Decoder {
565
565
  const figcaption = this.getFigcaption(model);
566
566
  const comments = this.createCommentNodes(model);
567
567
  comments.forEach((c) => this.comments.set(c.attrs.id, c));
568
- const content = tableElementFooter
569
- ? [table, tableElementFooter, figcaption]
570
- : [table, figcaption];
568
+ const content = [table];
571
569
  if (tableColGroup) {
572
570
  content.unshift(tableColGroup);
573
571
  }
572
+ if (tableElementFooter) {
573
+ content.push(tableElementFooter);
574
+ }
575
+ content.push(figcaption);
574
576
  if (model.listingID) {
575
577
  const listing = this.createListing(model.listingID);
576
578
  content.push(listing);
@@ -13,46 +13,9 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { Node } from 'prosemirror-model';
17
- import { TableNodes, TableNodesOptions } from 'prosemirror-tables';
18
- export declare function createTableNodes(options: TableNodesOptions): TableNodes;
16
+ import { TableNodes } from 'prosemirror-tables';
19
17
  export declare const tableNodes: TableNodes;
20
- export declare const table: {
21
- attrs: {
22
- id: {
23
- default: string;
24
- };
25
- dataTracked: {
26
- default: null;
27
- };
28
- comments: {
29
- default: null;
30
- };
31
- headerRows: {
32
- default: number;
33
- };
34
- footerRows: {
35
- default: number;
36
- };
37
- };
38
- content?: string | undefined;
39
- marks?: string | undefined;
40
- group?: string | undefined;
41
- inline?: boolean | undefined;
42
- atom?: boolean | undefined;
43
- selectable?: boolean | undefined;
44
- draggable?: boolean | undefined;
45
- code?: boolean | undefined;
46
- whitespace?: "pre" | "normal" | undefined;
47
- definingAsContext?: boolean | undefined;
48
- definingForContent?: boolean | undefined;
49
- defining?: boolean | undefined;
50
- isolating?: boolean | undefined;
51
- toDOM?: ((node: Node) => import("prosemirror-model").DOMOutputSpec) | undefined;
52
- parseDOM?: readonly import("prosemirror-model").ParseRule[] | undefined;
53
- toDebugString?: ((node: Node) => string) | undefined;
54
- leafText?: ((node: Node) => string) | undefined;
55
- };
18
+ export declare const table: import("prosemirror-model").NodeSpec;
56
19
  export declare const tableRow: import("prosemirror-model").NodeSpec;
57
20
  export declare const tableCell: import("prosemirror-model").NodeSpec;
58
21
  export declare const tableHeader: import("prosemirror-model").NodeSpec;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@manuscripts/transform",
3
3
  "description": "ProseMirror transformer for Manuscripts applications",
4
- "version": "2.1.1-LEAN-3336-13",
4
+ "version": "2.1.1-LEAN-3336-14",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-transform",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",