@manuscripts/transform 2.3.22-LEAN-3828.0 → 2.3.22

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.
@@ -221,7 +221,7 @@ exports.jatsBodyTransformations = {
221
221
  moveCaptionsToEnd(body) {
222
222
  const captions = body.querySelectorAll('caption');
223
223
  for (const caption of captions) {
224
- if (caption.parentNode) {
224
+ if (caption.parentNode && caption.parentNode.nodeName !== 'table-wrap') {
225
225
  caption.parentNode.appendChild(caption);
226
226
  }
227
227
  }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class Migration2322 {
4
+ constructor() {
5
+ this.fromVersion = '2.3.21';
6
+ this.toVersion = '2.3.22';
7
+ }
8
+ migrateNode(node) {
9
+ if (node.type === 'table_element' && Array.isArray(node.content)) {
10
+ let figcaptionNode = null;
11
+ const remainingContent = [];
12
+ for (const child of node.content) {
13
+ if (child.type === 'figcaption') {
14
+ figcaptionNode = child;
15
+ }
16
+ else {
17
+ remainingContent.push(child);
18
+ }
19
+ }
20
+ const newContent = figcaptionNode
21
+ ? [figcaptionNode, ...remainingContent]
22
+ : remainingContent;
23
+ return Object.assign(Object.assign({}, node), { content: newContent });
24
+ }
25
+ return node;
26
+ }
27
+ }
28
+ exports.default = Migration2322;
@@ -19,5 +19,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
19
19
  };
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
21
  const _1_2_5_1 = __importDefault(require("./1.2.5"));
22
- const migrations = [new _1_2_5_1.default()];
22
+ const _2_3_22_1 = __importDefault(require("./2.3.22"));
23
+ const migrations = [new _1_2_5_1.default(), new _2_3_22_1.default()];
23
24
  exports.default = migrations;
@@ -17,7 +17,7 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.tableElement = void 0;
19
19
  exports.tableElement = {
20
- content: '(table | placeholder) table_colgroup? table_element_footer? figcaption? (listing | placeholder)',
20
+ content: ' figcaption? (table | placeholder) table_colgroup? table_element_footer? (listing | placeholder)',
21
21
  attrs: {
22
22
  id: { default: '' },
23
23
  paragraphStyle: { default: '' },
@@ -615,14 +615,13 @@ class Decoder {
615
615
  const figcaption = this.getFigcaption(model);
616
616
  const comments = this.createCommentNodes(model);
617
617
  comments.forEach((c) => this.comments.set(c.attrs.id, c));
618
- const content = [table];
618
+ const content = [figcaption, table];
619
619
  if (tableColGroup) {
620
620
  content.push(tableColGroup);
621
621
  }
622
622
  if (tableElementFooter) {
623
623
  content.push(tableElementFooter);
624
624
  }
625
- content.push(figcaption);
626
625
  const listing = model.listingID
627
626
  ? this.createListing(model.listingID)
628
627
  : schema_1.schema.nodes.listing.create();
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = "2.3.22-LEAN-3828.0";
4
+ exports.VERSION = "2.3.22";
@@ -218,7 +218,7 @@ export const jatsBodyTransformations = {
218
218
  moveCaptionsToEnd(body) {
219
219
  const captions = body.querySelectorAll('caption');
220
220
  for (const caption of captions) {
221
- if (caption.parentNode) {
221
+ if (caption.parentNode && caption.parentNode.nodeName !== 'table-wrap') {
222
222
  caption.parentNode.appendChild(caption);
223
223
  }
224
224
  }
@@ -0,0 +1,26 @@
1
+ class Migration2322 {
2
+ constructor() {
3
+ this.fromVersion = '2.3.21';
4
+ this.toVersion = '2.3.22';
5
+ }
6
+ migrateNode(node) {
7
+ if (node.type === 'table_element' && Array.isArray(node.content)) {
8
+ let figcaptionNode = null;
9
+ const remainingContent = [];
10
+ for (const child of node.content) {
11
+ if (child.type === 'figcaption') {
12
+ figcaptionNode = child;
13
+ }
14
+ else {
15
+ remainingContent.push(child);
16
+ }
17
+ }
18
+ const newContent = figcaptionNode
19
+ ? [figcaptionNode, ...remainingContent]
20
+ : remainingContent;
21
+ return Object.assign(Object.assign({}, node), { content: newContent });
22
+ }
23
+ return node;
24
+ }
25
+ }
26
+ export default Migration2322;
@@ -14,5 +14,6 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import Migration125 from './1.2.5';
17
- const migrations = [new Migration125()];
17
+ import Migration2322 from './2.3.22';
18
+ const migrations = [new Migration125(), new Migration2322()];
18
19
  export default migrations;
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export const tableElement = {
17
- content: '(table | placeholder) table_colgroup? table_element_footer? figcaption? (listing | placeholder)',
17
+ content: ' figcaption? (table | placeholder) table_colgroup? table_element_footer? (listing | placeholder)',
18
18
  attrs: {
19
19
  id: { default: '' },
20
20
  paragraphStyle: { default: '' },
@@ -606,14 +606,13 @@ export class Decoder {
606
606
  const figcaption = this.getFigcaption(model);
607
607
  const comments = this.createCommentNodes(model);
608
608
  comments.forEach((c) => this.comments.set(c.attrs.id, c));
609
- const content = [table];
609
+ const content = [figcaption, table];
610
610
  if (tableColGroup) {
611
611
  content.push(tableColGroup);
612
612
  }
613
613
  if (tableElementFooter) {
614
614
  content.push(tableElementFooter);
615
615
  }
616
- content.push(figcaption);
617
616
  const listing = model.listingID
618
617
  ? this.createListing(model.listingID)
619
618
  : schema.nodes.listing.create();
@@ -1 +1 @@
1
- export const VERSION = "2.3.22-LEAN-3828.0";
1
+ export const VERSION = "2.3.22";
@@ -0,0 +1,8 @@
1
+ import { JSONNode } from '../migrate';
2
+ import { MigrationScript } from '../migration-script';
3
+ declare class Migration2322 implements MigrationScript {
4
+ fromVersion: string;
5
+ toVersion: string;
6
+ migrateNode(node: JSONNode): JSONNode;
7
+ }
8
+ export default Migration2322;
@@ -14,5 +14,6 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import Migration125 from './1.2.5';
17
- declare const migrations: Migration125[];
17
+ import Migration2322 from './2.3.22';
18
+ declare const migrations: (Migration125 | Migration2322)[];
18
19
  export default migrations;
@@ -1 +1 @@
1
- export declare const VERSION = "2.3.22-LEAN-3828.0";
1
+ export declare const VERSION = "2.3.22";
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.3.22-LEAN-3828.0",
4
+ "version": "2.3.22",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-transform",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@manuscripts/json-schema": "2.2.10",
34
- "@manuscripts/library": "1.3.11-LEAN-3828.1",
34
+ "@manuscripts/library": "1.3.10",
35
35
  "debug": "^4.3.4",
36
36
  "jszip": "^3.10.1",
37
37
  "lodash": "^4.17.21",