@manuscripts/article-editor 3.1.7 → 3.1.8-JSR

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.
Files changed (168) hide show
  1. package/dist/cjs/EditorApp.js +4 -7
  2. package/dist/cjs/EditorApp.js.map +1 -1
  3. package/dist/cjs/components/Page.js +1 -2
  4. package/dist/cjs/components/Page.js.map +1 -1
  5. package/dist/cjs/components/inspector/SectionInspector.js +43 -18
  6. package/dist/cjs/components/inspector/SectionInspector.js.map +1 -1
  7. package/dist/cjs/components/projects/CategoryInput.js +1 -1
  8. package/dist/cjs/components/projects/CategoryInput.js.map +1 -1
  9. package/dist/cjs/components/projects/ContentTab.js +35 -16
  10. package/dist/cjs/components/projects/ContentTab.js.map +1 -1
  11. package/dist/cjs/components/projects/EditorElement.js +5 -3
  12. package/dist/cjs/components/projects/EditorElement.js.map +1 -1
  13. package/dist/cjs/components/projects/Inspector.js +2 -8
  14. package/dist/cjs/components/projects/Inspector.js.map +1 -1
  15. package/dist/cjs/components/projects/ManuscriptMenus.js +9 -2
  16. package/dist/cjs/components/projects/ManuscriptMenus.js.map +1 -1
  17. package/dist/cjs/components/projects/ManuscriptPageContainer.js +24 -120
  18. package/dist/cjs/components/projects/ManuscriptPageContainer.js.map +1 -1
  19. package/dist/cjs/components/projects/ManuscriptSidebar.js +8 -2
  20. package/dist/cjs/components/projects/ManuscriptSidebar.js.map +1 -1
  21. package/dist/cjs/components/projects/ManuscriptToolbar.js +12 -5
  22. package/dist/cjs/components/projects/ManuscriptToolbar.js.map +1 -1
  23. package/dist/cjs/components/track-changes/TrackChangesPanel.js +27 -41
  24. package/dist/cjs/components/track-changes/TrackChangesPanel.js.map +1 -1
  25. package/dist/cjs/components/track-changes/TrackModal.js +20 -8
  26. package/dist/cjs/components/track-changes/TrackModal.js.map +1 -1
  27. package/dist/cjs/components/track-changes/suggestion-list/Suggestion.js +3 -1
  28. package/dist/cjs/components/track-changes/suggestion-list/Suggestion.js.map +1 -1
  29. package/dist/cjs/components/track-changes/suggestion-list/SuggestionList.js +1 -1
  30. package/dist/cjs/components/track-changes/suggestion-list/SuggestionList.js.map +1 -1
  31. package/dist/cjs/components/track-changes/utils.js +28 -5
  32. package/dist/cjs/components/track-changes/utils.js.map +1 -1
  33. package/dist/cjs/hooks/use-connect-editor.js +74 -0
  34. package/dist/cjs/hooks/use-connect-editor.js.map +1 -0
  35. package/dist/cjs/hooks/use-create-editor.js +7 -6
  36. package/dist/cjs/hooks/use-create-editor.js.map +1 -1
  37. package/dist/cjs/hooks/use-exec-cmd.js +6 -4
  38. package/dist/cjs/hooks/use-exec-cmd.js.map +1 -1
  39. package/dist/cjs/lib/attrs-change-filter.js +7 -7
  40. package/dist/cjs/lib/attrs-change-filter.js.map +1 -1
  41. package/dist/cjs/lib/deeper-equal.js +19 -17
  42. package/dist/cjs/lib/deeper-equal.js.map +1 -1
  43. package/dist/cjs/lib/section-categories.js +9 -9
  44. package/dist/cjs/lib/section-categories.js.map +1 -1
  45. package/dist/cjs/postgres-data/PsSource.js +19 -2
  46. package/dist/cjs/postgres-data/PsSource.js.map +1 -1
  47. package/dist/cjs/postgres-data/buildData.js +17 -26
  48. package/dist/cjs/postgres-data/buildData.js.map +1 -1
  49. package/dist/cjs/postgres-data/buildUtilities.js +4 -65
  50. package/dist/cjs/postgres-data/buildUtilities.js.map +1 -1
  51. package/dist/cjs/quarterback/api/loadDoc.js +108 -0
  52. package/dist/cjs/quarterback/api/loadDoc.js.map +1 -0
  53. package/dist/cjs/store/Store.js.map +1 -1
  54. package/dist/cjs/store/StoreContext.js +1 -1
  55. package/dist/cjs/store/StoreContext.js.map +1 -1
  56. package/dist/cjs/store/useStore.js +7 -1
  57. package/dist/cjs/store/useStore.js.map +1 -1
  58. package/dist/es/EditorApp.js +4 -7
  59. package/dist/es/EditorApp.js.map +1 -1
  60. package/dist/es/components/Page.js +1 -2
  61. package/dist/es/components/Page.js.map +1 -1
  62. package/dist/es/components/inspector/SectionInspector.js +43 -18
  63. package/dist/es/components/inspector/SectionInspector.js.map +1 -1
  64. package/dist/es/components/projects/CategoryInput.js +2 -2
  65. package/dist/es/components/projects/CategoryInput.js.map +1 -1
  66. package/dist/es/components/projects/ContentTab.js +13 -14
  67. package/dist/es/components/projects/ContentTab.js.map +1 -1
  68. package/dist/es/components/projects/EditorElement.js +5 -3
  69. package/dist/es/components/projects/EditorElement.js.map +1 -1
  70. package/dist/es/components/projects/Inspector.js +2 -8
  71. package/dist/es/components/projects/Inspector.js.map +1 -1
  72. package/dist/es/components/projects/ManuscriptMenus.js +9 -2
  73. package/dist/es/components/projects/ManuscriptMenus.js.map +1 -1
  74. package/dist/es/components/projects/ManuscriptPageContainer.js +24 -97
  75. package/dist/es/components/projects/ManuscriptPageContainer.js.map +1 -1
  76. package/dist/es/components/projects/ManuscriptSidebar.js +8 -2
  77. package/dist/es/components/projects/ManuscriptSidebar.js.map +1 -1
  78. package/dist/es/components/projects/ManuscriptToolbar.js +12 -5
  79. package/dist/es/components/projects/ManuscriptToolbar.js.map +1 -1
  80. package/dist/es/components/track-changes/TrackChangesPanel.js +28 -42
  81. package/dist/es/components/track-changes/TrackChangesPanel.js.map +1 -1
  82. package/dist/es/components/track-changes/TrackModal.js +21 -9
  83. package/dist/es/components/track-changes/TrackModal.js.map +1 -1
  84. package/dist/es/components/track-changes/suggestion-list/Suggestion.js +3 -1
  85. package/dist/es/components/track-changes/suggestion-list/Suggestion.js.map +1 -1
  86. package/dist/es/components/track-changes/suggestion-list/SuggestionList.js +1 -1
  87. package/dist/es/components/track-changes/suggestion-list/SuggestionList.js.map +1 -1
  88. package/dist/es/components/track-changes/utils.js +25 -3
  89. package/dist/es/components/track-changes/utils.js.map +1 -1
  90. package/dist/es/hooks/use-connect-editor.js +70 -0
  91. package/dist/es/hooks/use-connect-editor.js.map +1 -0
  92. package/dist/es/hooks/use-create-editor.js +7 -6
  93. package/dist/es/hooks/use-create-editor.js.map +1 -1
  94. package/dist/es/hooks/use-exec-cmd.js +7 -5
  95. package/dist/es/hooks/use-exec-cmd.js.map +1 -1
  96. package/dist/es/lib/attrs-change-filter.js +7 -7
  97. package/dist/es/lib/attrs-change-filter.js.map +1 -1
  98. package/dist/es/lib/deeper-equal.js +19 -17
  99. package/dist/es/lib/deeper-equal.js.map +1 -1
  100. package/dist/es/lib/section-categories.js +7 -7
  101. package/dist/es/lib/section-categories.js.map +1 -1
  102. package/dist/es/postgres-data/PsSource.js +19 -2
  103. package/dist/es/postgres-data/PsSource.js.map +1 -1
  104. package/dist/es/postgres-data/buildData.js +18 -27
  105. package/dist/es/postgres-data/buildData.js.map +1 -1
  106. package/dist/es/postgres-data/buildUtilities.js +5 -66
  107. package/dist/es/postgres-data/buildUtilities.js.map +1 -1
  108. package/dist/es/quarterback/api/loadDoc.js +81 -0
  109. package/dist/es/quarterback/api/loadDoc.js.map +1 -0
  110. package/dist/es/store/Store.js.map +1 -1
  111. package/dist/es/store/StoreContext.js +1 -1
  112. package/dist/es/store/StoreContext.js.map +1 -1
  113. package/dist/es/store/useStore.js +5 -0
  114. package/dist/es/store/useStore.js.map +1 -1
  115. package/dist/types/components/Page.d.ts +1 -3
  116. package/dist/types/components/inspector/SectionInspector.d.ts +1 -15
  117. package/dist/types/components/projects/ContentTab.d.ts +1 -5
  118. package/dist/types/components/projects/EditorElement.d.ts +1 -16
  119. package/dist/types/components/projects/Inspector.d.ts +1 -5
  120. package/dist/types/components/projects/ManuscriptMenus.d.ts +1 -6
  121. package/dist/types/components/projects/ManuscriptPageContainer.d.ts +1 -1
  122. package/dist/types/components/projects/ManuscriptSidebar.d.ts +1 -9
  123. package/dist/types/components/projects/ManuscriptToolbar.d.ts +1 -7
  124. package/dist/types/components/track-changes/suggestion-list/SuggestionList.d.ts +1 -1
  125. package/dist/types/components/track-changes/utils.d.ts +6 -2
  126. package/dist/types/hooks/use-connect-editor.d.ts +9 -0
  127. package/dist/types/lib/attrs-change-filter.d.ts +2 -3
  128. package/dist/types/lib/deeper-equal.d.ts +1 -1
  129. package/dist/types/lib/section-categories.d.ts +4 -4
  130. package/dist/types/postgres-data/buildData.d.ts +2 -1
  131. package/dist/types/quarterback/{useLoadDoc.d.ts → api/loadDoc.d.ts} +2 -2
  132. package/dist/types/store/Store.d.ts +9 -14
  133. package/dist/types/store/useStore.d.ts +1 -0
  134. package/package.json +5 -5
  135. package/dist/cjs/components/inspector/StyleFields.js +0 -18
  136. package/dist/cjs/components/inspector/StyleFields.js.map +0 -1
  137. package/dist/cjs/lib/sort.js +0 -17
  138. package/dist/cjs/lib/sort.js.map +0 -1
  139. package/dist/cjs/quarterback/QuarterBackDataSource.js +0 -29
  140. package/dist/cjs/quarterback/QuarterBackDataSource.js.map +0 -1
  141. package/dist/cjs/quarterback/useLoadDoc.js +0 -109
  142. package/dist/cjs/quarterback/useLoadDoc.js.map +0 -1
  143. package/dist/cjs/tracked-models/adapt-tracked-data.js +0 -100
  144. package/dist/cjs/tracked-models/adapt-tracked-data.js.map +0 -1
  145. package/dist/cjs/tracked-models/creators.js +0 -129
  146. package/dist/cjs/tracked-models/creators.js.map +0 -1
  147. package/dist/cjs/tracked-models/use-tracked-model-management.js +0 -129
  148. package/dist/cjs/tracked-models/use-tracked-model-management.js.map +0 -1
  149. package/dist/es/components/inspector/StyleFields.js +0 -14
  150. package/dist/es/components/inspector/StyleFields.js.map +0 -1
  151. package/dist/es/lib/sort.js +0 -13
  152. package/dist/es/lib/sort.js.map +0 -1
  153. package/dist/es/quarterback/QuarterBackDataSource.js +0 -26
  154. package/dist/es/quarterback/QuarterBackDataSource.js.map +0 -1
  155. package/dist/es/quarterback/useLoadDoc.js +0 -82
  156. package/dist/es/quarterback/useLoadDoc.js.map +0 -1
  157. package/dist/es/tracked-models/adapt-tracked-data.js +0 -95
  158. package/dist/es/tracked-models/adapt-tracked-data.js.map +0 -1
  159. package/dist/es/tracked-models/creators.js +0 -120
  160. package/dist/es/tracked-models/creators.js.map +0 -1
  161. package/dist/es/tracked-models/use-tracked-model-management.js +0 -127
  162. package/dist/es/tracked-models/use-tracked-model-management.js.map +0 -1
  163. package/dist/types/components/inspector/StyleFields.d.ts +0 -14
  164. package/dist/types/lib/sort.d.ts +0 -17
  165. package/dist/types/quarterback/QuarterBackDataSource.d.ts +0 -23
  166. package/dist/types/tracked-models/adapt-tracked-data.d.ts +0 -13
  167. package/dist/types/tracked-models/creators.d.ts +0 -21
  168. package/dist/types/tracked-models/use-tracked-model-management.d.ts +0 -21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manuscripts/article-editor",
3
- "version": "3.1.7",
3
+ "version": "3.1.8-JSR",
4
4
  "license": "CPAL-1.0",
5
5
  "description": "React components for editing and viewing manuscripts",
6
6
  "repository": "github:Atypon-OpenSource/manuscripts-article-editor",
@@ -35,12 +35,12 @@
35
35
  "@fontsource/lato": "^4.5.10",
36
36
  "@fontsource/pt-sans": "^4.5.11",
37
37
  "@fontsource/pt-serif": "^4.5.11",
38
- "@manuscripts/body-editor": "2.0.13",
38
+ "@manuscripts/body-editor": "2.0.14-JSR",
39
39
  "@manuscripts/json-schema": "2.2.10",
40
40
  "@manuscripts/library": "1.3.10",
41
- "@manuscripts/style-guide": "2.0.2",
41
+ "@manuscripts/style-guide": "2.0.3",
42
42
  "@manuscripts/track-changes-plugin": "1.7.17",
43
- "@manuscripts/transform": "2.3.21",
43
+ "@manuscripts/transform": "2.3.22-JSR",
44
44
  "prosemirror-utils": "^0.9.6",
45
45
  "@popperjs/core": "^2.11.8",
46
46
  "@reach/tabs": "^0.18.0",
@@ -108,4 +108,4 @@
108
108
  "resolutions": {
109
109
  "@types/react": "^18.3.1"
110
110
  }
111
- }
111
+ }
@@ -1,18 +0,0 @@
1
- "use strict";
2
- /*!
3
- * The contents of this file are subject to the Common Public Attribution License Version 1.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://mpapp-public.gitlab.io/manuscripts-frontend/LICENSE. The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B.
4
- *
5
- * Software distributed under the License is distributed on an “AS IS” basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
6
- *
7
- * The Original Code is manuscripts-frontend.
8
- *
9
- * The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
10
- *
11
- * All portions of the code written by Atypon Systems LLC are Copyright (c) 2019 Atypon Systems LLC. All Rights Reserved.
12
- */
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.valueOrDefault = void 0;
15
- // TODO: use nullish coalescing instead
16
- const valueOrDefault = (value, defaultValue) => (value === undefined ? defaultValue : value);
17
- exports.valueOrDefault = valueOrDefault;
18
- //# sourceMappingURL=StyleFields.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"StyleFields.js","sourceRoot":"","sources":["../../../../src/components/inspector/StyleFields.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAMH,uCAAuC;AAChC,MAAM,cAAc,GAAG,CAC5B,KAAoB,EACpB,YAAe,EACZ,EAAE,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;AAHvC,QAAA,cAAc,kBAGyB"}
@@ -1,17 +0,0 @@
1
- "use strict";
2
- /*!
3
- * The contents of this file are subject to the Common Public Attribution License Version 1.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://mpapp-public.gitlab.io/manuscripts-frontend/LICENSE. The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B.
4
- *
5
- * Software distributed under the License is distributed on an “AS IS” basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
6
- *
7
- * The Original Code is manuscripts-frontend.
8
- *
9
- * The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
10
- *
11
- * All portions of the code written by Atypon Systems LLC are Copyright (c) 2019 Atypon Systems LLC. All Rights Reserved.
12
- */
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.ascendingPriority = void 0;
15
- const ascendingPriority = (a, b) => Number(a.priority) - Number(b.priority);
16
- exports.ascendingPriority = ascendingPriority;
17
- //# sourceMappingURL=sort.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sort.js","sourceRoot":"","sources":["../../../src/lib/sort.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAMI,MAAM,iBAAiB,GAAG,CAC/B,CAAoB,EACpB,CAAoB,EACZ,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAA;AAHvC,QAAA,iBAAiB,qBAGsB"}
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- class QuarterbackDataSource {
4
- constructor(loadDoc) {
5
- this.build = async (state, next) => {
6
- if (state.projectID && state.manuscriptID) {
7
- const res = await this.loadDoc(state.manuscriptID, state.projectID, state.doc);
8
- if (res?.doc && res.version >= 0) {
9
- next({
10
- ...state,
11
- doc: res.doc,
12
- initialDocVersion: res.version,
13
- snapshots: res.snapshots,
14
- snapshotsMap: new Map(),
15
- });
16
- return;
17
- }
18
- }
19
- next({
20
- ...state,
21
- snapshots: [],
22
- snapshotsMap: new Map(),
23
- });
24
- };
25
- this.loadDoc = loadDoc;
26
- }
27
- }
28
- exports.default = QuarterbackDataSource;
29
- //# sourceMappingURL=QuarterBackDataSource.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"QuarterBackDataSource.js","sourceRoot":"","sources":["../../../src/quarterback/QuarterBackDataSource.ts"],"names":[],"mappings":";;AAgBA,MAAqB,qBAAqB;IAaxC,YAAY,OAAyC;QAGrD,UAAK,GAAc,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;YACvC,IAAI,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC,YAAY,EAAE;gBACzC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,OAAO,CAC5B,KAAK,CAAC,YAAY,EAClB,KAAK,CAAC,SAAS,EACf,KAAK,CAAC,GAAG,CACV,CAAA;gBACD,IAAI,GAAG,EAAE,GAAG,IAAI,GAAG,CAAC,OAAO,IAAI,CAAC,EAAE;oBAChC,IAAI,CAAC;wBACH,GAAG,KAAK;wBACR,GAAG,EAAE,GAAG,CAAC,GAAG;wBACZ,iBAAiB,EAAE,GAAG,CAAC,OAAO;wBAC9B,SAAS,EAAE,GAAG,CAAC,SAAS;wBACxB,YAAY,EAAE,IAAI,GAAG,EAA8B;qBACpD,CAAC,CAAA;oBACF,OAAM;iBACP;aACF;YACD,IAAI,CAAC;gBACH,GAAG,KAAK;gBACR,SAAS,EAAE,EAAE;gBACb,YAAY,EAAE,IAAI,GAAG,EAA8B;aACpD,CAAC,CAAA;QACJ,CAAC,CAAA;QAzBC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;CAyBF;AAxCD,wCAwCC"}
@@ -1,109 +0,0 @@
1
- "use strict";
2
- /*!
3
- * The contents of this file are subject to the Common Public Attribution License Version 1.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://mpapp-public.gitlab.io/manuscripts-frontend/LICENSE. The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B.
4
- *
5
- * Software distributed under the License is distributed on an “AS IS” basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
6
- *
7
- * The Original Code is manuscripts-frontend.
8
- *
9
- * The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
10
- *
11
- * All portions of the code written by Atypon Systems LLC are Copyright (c) 2022 Atypon Systems LLC. All Rights Reserved.
12
- */
13
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
- if (k2 === undefined) k2 = k;
15
- var desc = Object.getOwnPropertyDescriptor(m, k);
16
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
- desc = { enumerable: true, get: function() { return m[k]; } };
18
- }
19
- Object.defineProperty(o, k2, desc);
20
- }) : (function(o, m, k, k2) {
21
- if (k2 === undefined) k2 = k;
22
- o[k2] = m[k];
23
- }));
24
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
- Object.defineProperty(o, "default", { enumerable: true, value: v });
26
- }) : function(o, v) {
27
- o["default"] = v;
28
- });
29
- var __importStar = (this && this.__importStar) || function (mod) {
30
- if (mod && mod.__esModule) return mod;
31
- var result = {};
32
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
- __setModuleDefault(result, mod);
34
- return result;
35
- };
36
- Object.defineProperty(exports, "__esModule", { value: true });
37
- exports.useLoadDoc = void 0;
38
- const transform_1 = require("@manuscripts/transform");
39
- const docApi = __importStar(require("./api/document"));
40
- const useLoadDoc = (authToken) => {
41
- return async function loadDoc(manuscriptID, projectID, existingDoc) {
42
- const resp = await docApi.getTransformVersion(authToken);
43
- if ('data' in resp && resp.data.transformVersion !== (0, transform_1.getVersion)()) {
44
- console.warn(`Warning! Manuscripts-transform (Frontend: ${(0, transform_1.getVersion)()}) version is different on manuscripts-api (${resp.data.transformVersion})`);
45
- }
46
- const found = await docApi.getDocument(projectID, manuscriptID, authToken);
47
- let doc;
48
- let version = 0;
49
- let snapshots = [];
50
- if ('data' in found) {
51
- let empty = true;
52
- for (const _ in found.data.doc) {
53
- empty = false;
54
- break;
55
- }
56
- if (empty) {
57
- if (!existingDoc) {
58
- throw new Error('Unable to produce valid doc as neither model based verions nor history have a valid version');
59
- }
60
- await docApi.updateDocument(projectID, manuscriptID, authToken, {
61
- doc: existingDoc.toJSON(),
62
- schema_version: (0, transform_1.getVersion)(),
63
- });
64
- }
65
- snapshots = found.data.snapshots;
66
- doc = found.data.doc;
67
- version = found.data.version;
68
- }
69
- else if ('err' in found && found.code === 404) {
70
- // Create an empty doc that will be replaced with whatever document is currently being edited
71
- const res = await docApi.createDocument({
72
- manuscript_model_id: manuscriptID,
73
- project_model_id: projectID,
74
- doc: {},
75
- schema_version: (0, transform_1.getVersion)(),
76
- }, authToken);
77
- if ('data' in res) {
78
- doc = res.data.doc;
79
- version = res.data.version;
80
- snapshots = res.data.snapshots;
81
- }
82
- if ('err' in res) {
83
- console.error('Unable to create new document: ' + res.err);
84
- }
85
- const update = await docApi.updateDocument(projectID, manuscriptID, authToken, {
86
- doc: existingDoc?.toJSON(),
87
- schema_version: (0, transform_1.getVersion)(),
88
- });
89
- if ('err' in update) {
90
- console.error('Unable to create new document: ' + update.err);
91
- }
92
- else {
93
- const found = await docApi.getDocument(projectID, manuscriptID, authToken);
94
- if ('data' in found && found.data.doc && found.data.version >= 0) {
95
- doc = found.data.doc;
96
- version = found.data.version;
97
- }
98
- }
99
- }
100
- if (doc !== null &&
101
- typeof doc === 'object' &&
102
- Object.keys(doc).length !== 0) {
103
- return { doc: transform_1.schema.nodeFromJSON(doc), version, snapshots };
104
- }
105
- return undefined;
106
- };
107
- };
108
- exports.useLoadDoc = useLoadDoc;
109
- //# sourceMappingURL=useLoadDoc.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useLoadDoc.js","sourceRoot":"","sources":["../../../src/quarterback/useLoadDoc.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,sDAA2E;AAE3E,uDAAwC;AAGjC,MAAM,UAAU,GAAG,CAAC,SAAiB,EAAE,EAAE;IAC9C,OAAO,KAAK,UAAU,OAAO,CAC3B,YAAoB,EACpB,SAAiB,E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K,QAAQ;YACvB,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,EAC7B;YACA,OAAO,EAAE,GAAG,EAAE,kBAAM,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAA;SAC7D;QACD,OAAO,SAAS,CAAA;IAClB,CAAC,CAAA;AACH,CAAC,CAAA;AA5FY,QAAA,UAAU,cA4FtB"}
@@ -1,100 +0,0 @@
1
- "use strict";
2
- /*!
3
- * The contents of this file are subject to the Common Public Attribution License Version 1.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://mpapp-public.gitlab.io/manuscripts-frontend/LICENSE. The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B.
4
- *
5
- * Software distributed under the License is distributed on an “AS IS” basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
6
- *
7
- * The Original Code is manuscripts-frontend.
8
- *
9
- * The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
10
- *
11
- * All portions of the code written by Atypon Systems LLC are Copyright (c) 2019 Atypon Systems LLC. All Rights Reserved.
12
- */
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.adaptTrackedData = exports.filterNodesWithTrackingData = void 0;
15
- const track_changes_plugin_1 = require("@manuscripts/track-changes-plugin");
16
- const hasTrackingData = (node) => {
17
- return !!node?.attrs?.dataTracked;
18
- };
19
- const filterNodesWithTrackingData = (node) => {
20
- const cleanDoc = Object.assign({}, node);
21
- const cleanNode = (parent) => {
22
- if (parent.content) {
23
- parent.content = parent.content.filter((child) => !hasTrackingData(child));
24
- parent.content.forEach((child) => cleanNode(child));
25
- }
26
- };
27
- cleanNode(cleanDoc);
28
- return cleanDoc;
29
- };
30
- exports.filterNodesWithTrackingData = filterNodesWithTrackingData;
31
- const getLastChange = (changes) => {
32
- return [...changes].sort((a, b) => b.updatedAt - a.updatedAt)[0];
33
- };
34
- const adaptTrackedData = (docJSONed) => {
35
- const cleanDoc = Object.assign({}, docJSONed);
36
- function deepCloneAttrs(object) {
37
- if (typeof object !== 'object' || object === null) {
38
- return object;
39
- }
40
- const copy = Array.isArray(object) ? [] : {};
41
- for (const at in object) {
42
- const deeperClone = deepCloneAttrs(object[at]);
43
- if (Array.isArray(object)) {
44
- // @ts-ignore
45
- copy.push(deeperClone);
46
- }
47
- else {
48
- // @ts-ignore
49
- copy[at] = deeperClone;
50
- }
51
- }
52
- return copy;
53
- }
54
- const cleanNode = (parent) => {
55
- parent.attrs = deepCloneAttrs(parent.attrs);
56
- // Prosemirror's Node.toJSON() references attributes so they have to be cloned to avoid disaster.
57
- // It must be done before content check for the nodes like figures
58
- if (parent.content) {
59
- parent.content = parent.content.filter((child) => {
60
- // the type is wrong. we get JSON and not the doc
61
- // pass through all the nodes with no track changes at all
62
- if (!child?.attrs?.dataTracked) {
63
- return true;
64
- }
65
- // consider this for future implementation: text changes are in general not to be regarded => meaning always to pass through
66
- const lastChange = getLastChange(child.attrs.dataTracked);
67
- // for the cases when we change attributes we need to pick oldAttributes if the last change is reject.
68
- // The oldAttributes are the last attributes before the rejected change
69
- // so they represent current real values
70
- if (lastChange.status == track_changes_plugin_1.CHANGE_STATUS.rejected &&
71
- lastChange.operation == track_changes_plugin_1.CHANGE_OPERATION.set_node_attributes) {
72
- // please notate that since we work on a copy of a document that is not active it is fine to assign readonly attributes
73
- // @ts-ignore
74
- child.attrs = deepCloneAttrs(lastChange.oldAttrs);
75
- return true;
76
- }
77
- // removing all the deleted nodes
78
- if (lastChange.operation == track_changes_plugin_1.CHANGE_OPERATION.delete &&
79
- lastChange.status !== track_changes_plugin_1.CHANGE_STATUS.rejected) {
80
- return false;
81
- }
82
- // removing supplement nodes in case insert rejected,
83
- // not sure if we will need to do it for other nodes
84
- if (child.type === 'supplement' &&
85
- lastChange.operation == track_changes_plugin_1.CHANGE_OPERATION.insert &&
86
- lastChange.status === track_changes_plugin_1.CHANGE_STATUS.rejected) {
87
- return false;
88
- }
89
- // @ts-ignore
90
- child.attrs = deepCloneAttrs(child.attrs) || {}; // @TODO: needs refactoring, in case when there is a dataTracked attribute, we deep copy attributes 2 times.
91
- return true;
92
- });
93
- parent.content.forEach((child) => cleanNode(child));
94
- }
95
- };
96
- cleanNode(cleanDoc);
97
- return cleanDoc;
98
- };
99
- exports.adaptTrackedData = adaptTrackedData;
100
- //# sourceMappingURL=adapt-tracked-data.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"adapt-tracked-data.js","sourceRoot":"","sources":["../../../src/tracked-models/adapt-tracked-data.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAEH,4EAI0C;AAG1C,MAAM,eAAe,GAAG,CAAC,IAAoB,EAAE,EAAE;IAC/C,OAAO,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,WAAW,CAAA;AACnC,CAAC,CAAA;AAEM,MAAM,2BAA2B,GAAG,CAAC,IAAS,EAAE,EAAE;IACvD,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,CAAA;IAExC,MAAM,SAAS,GAAG,CAAC,MAAW,EAAE,EAAE;QAChC,IAAI,MAAM,CAAC,OAAO,EAAE;YAClB,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CACpC,CAAC,KAAqB,EAAE,EAAE,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC,CACnD,CAAA;YACD,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,KAAqB,EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAA;SACpE;IACH,CAAC,CAAA;IAED,SAAS,CAAC,QAAQ,CAAC,CAAA;IAEnB,OAAO,QAAQ,CAAA;AACjB,CAAC,CAAA;AAfY,QAAA,2BAA2B,+BAevC;AAED,MAA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,CAAA;AACjB,CAAC,CAAA;AA7EY,QAAA,gBAAgB,oBA6E5B"}
@@ -1,129 +0,0 @@
1
- "use strict";
2
- /*!
3
- * The contents of this file are subject to the Common Public Attribution License Version 1.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://mpapp-public.gitlab.io/manuscripts-frontend/LICENSE. The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B.
4
- *
5
- * Software distributed under the License is distributed on an “AS IS” basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
6
- *
7
- * The Original Code is manuscripts-frontend.
8
- *
9
- * The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
10
- *
11
- * All portions of the code written by Atypon Systems LLC are Copyright (c) 2019 Atypon Systems LLC. All Rights Reserved.
12
- */
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.deleteSupplementNode = exports.createSupplementNode = exports.deleteComment = exports.saveComment = exports.createAffiliationNode = exports.createContributorNode = void 0;
15
- const body_editor_1 = require("@manuscripts/body-editor");
16
- const track_changes_plugin_1 = require("@manuscripts/track-changes-plugin");
17
- const transform_1 = require("@manuscripts/transform");
18
- const createContributorNode = (model, view, doc, state) => {
19
- const { tr } = state;
20
- doc.descendants((node, pos) => {
21
- if (node.type === transform_1.schema.nodes.contributors) {
22
- tr.insert(pos + 1, transform_1.schema.nodes.contributor.create({
23
- ...model,
24
- id: model._id,
25
- }, transform_1.schema.text('_')
26
- /*
27
- quarterback as it is now works incorrectly with empty nodes and updating attributes on them is misinterpreted as deletion.
28
- We either need to update quarterback to work correctly with empty nodes attributes or provide some content for these nodes or
29
- implement a mechanism that would detect attributes updates on empty nodes and setMeta as we do for metaNodes
30
- */
31
- ));
32
- view.dispatch(tr);
33
- return false;
34
- }
35
- });
36
- };
37
- exports.createContributorNode = createContributorNode;
38
- const createAffiliationNode = (model, view, doc, state) => {
39
- const { tr } = state;
40
- doc.descendants((node, pos) => {
41
- if (node.type === transform_1.schema.nodes.affiliations) {
42
- tr.insert(pos + node.nodeSize - 1, transform_1.schema.nodes.affiliation.create({
43
- ...model,
44
- id: model._id,
45
- }, transform_1.schema.text('_')));
46
- view.dispatch(tr);
47
- return false;
48
- }
49
- });
50
- };
51
- exports.createAffiliationNode = createAffiliationNode;
52
- const saveComment = (comment, view, doc, state, modelMap) => {
53
- const documentComment = {
54
- id: comment._id,
55
- contents: comment.contents,
56
- target: comment.target,
57
- selector: comment.selector,
58
- contributions: comment.contributions,
59
- resolved: comment.resolved,
60
- originalText: comment.originalText,
61
- };
62
- const isNewComment = !modelMap.has(comment._id);
63
- const { tr } = state;
64
- doc.descendants((node, pos) => {
65
- if (isNewComment) {
66
- /** for new comments will add comment node to the comment list node
67
- * */
68
- if (node.type === transform_1.schema.nodes.comments) {
69
- (0, track_changes_plugin_1.skipTracking)(tr.replaceWith(pos, pos + node.nodeSize, node.content.addToEnd(transform_1.schema.nodes.comment.create(documentComment))));
70
- return false;
71
- }
72
- }
73
- else {
74
- if (node.attrs.id === comment._id && node.type === transform_1.schema.nodes.comment) {
75
- (0, track_changes_plugin_1.skipTracking)(tr.setNodeMarkup(pos, undefined, {
76
- ...documentComment,
77
- }));
78
- return false;
79
- }
80
- }
81
- });
82
- (0, body_editor_1.clearCommentSelection)(tr);
83
- view.dispatch(tr);
84
- return Promise.resolve(comment);
85
- };
86
- exports.saveComment = saveComment;
87
- const deleteComment = (comment, view, doc, state) => {
88
- const { tr } = state;
89
- doc.descendants((node, pos) => {
90
- if (node.attrs.id === comment._id && node.type === transform_1.schema.nodes.comment) {
91
- tr.delete(pos, pos + node.nodeSize);
92
- tr.setMeta('track-changes-skip-tracking', true);
93
- (0, body_editor_1.clearCommentSelection)(tr);
94
- view.dispatch(tr);
95
- return false;
96
- }
97
- });
98
- return Promise.resolve(comment._id);
99
- };
100
- exports.deleteComment = deleteComment;
101
- const createSupplementNode = (view, supplement) => {
102
- view.state.doc.descendants((node, pos) => {
103
- if (node.type === transform_1.schema.nodes.supplements) {
104
- view.dispatch(view.state.tr.insert(pos + node.nodeSize - 1, transform_1.schema.nodes.supplement.create({
105
- id: supplement._id,
106
- href: supplement.href,
107
- mimeType: supplement.MIME?.split('/')[0],
108
- mimeSubType: supplement.MIME?.split('/')[1],
109
- title: supplement.title,
110
- })));
111
- return false;
112
- }
113
- });
114
- return Promise.resolve(supplement);
115
- };
116
- exports.createSupplementNode = createSupplementNode;
117
- const deleteSupplementNode = (view, supplement) => {
118
- const tr = view.state.tr;
119
- tr.doc.descendants((node, pos) => {
120
- if (node.type === transform_1.schema.nodes.supplement &&
121
- supplement._id === node.attrs.id) {
122
- tr.delete(pos, pos + node.nodeSize);
123
- }
124
- });
125
- view.dispatch(tr);
126
- return Promise.resolve(supplement);
127
- };
128
- exports.deleteSupplementNode = deleteSupplementNode;
129
- //# sourceMappingURL=creators.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"creators.js","sourceRoot":"","sources":["../../../src/tracked-models/creators.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAEH,0DAAgE;AAQhE,4EAAgE;AAChE,sDAA+C;AAKxC,MAAM,qBAAqB,GAAG,CACnC,KAA2B,EAC3B,IAAgB,EAChB,GAAoB,EACpB,KAAkB,EAClB,EAAE;IACF,MAAM,EAAE,EAAE,EAAE,GAAG,KAAK,CAAA;IACpB,GAAG,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;QAC5B,IAAI,IAAI,CAAC,IAAI,KAAK,kBAAM,CAAC,KAAK,CAAC,YAAY,EAAE;YAC3C,EAAE,CAAC,MAAM,CACP,GAAG,GAAG,CAAC,EACP,kBAAM,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAC7B;gBACE,GAAG,KAAK;gBACR,EAAE,EAAE,KAAK,CAAC,GAAG;aACd,EACD,kBAAM,CAAC,I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AC,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;gBAC3C,KAAK,EAAE,UAAU,CAAC,KAAK;aACxB,CAAC,CACH,CACF,CAAA;YACD,OAAO,KAAK,CAAA;SACb;IACH,CAAC,CAAC,CAAA;IACF,OAAO,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAA;AACpC,CAAC,CAAA;AAtBY,QAAA,oBAAoB,wBAsBhC;AAEM,MAAM,oBAAoB,GAAG,CAClC,IAAgB,EAChB,UAAsB,EACtB,EAAE;IACF,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAA;IACxB,EAAE,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;QAC/B,IACE,IAAI,CAAC,IAAI,KAAK,kBAAM,CAAC,KAAK,CAAC,UAAU;YACrC,UAAU,CAAC,GAAG,KAAK,IAAI,CAAC,KAAK,CAAC,EAAE,EAChC;YACA,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAA;SACpC;IACH,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;IAEjB,OAAO,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAA;AACpC,CAAC,CAAA;AAjBY,QAAA,oBAAoB,wBAiBhC"}
@@ -1,129 +0,0 @@
1
- "use strict";
2
- /*!
3
- * The contents of this file are subject to the Common Public Attribution License Version 1.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://mpapp-public.gitlab.io/manuscripts-frontend/LICENSE. The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B.
4
- *
5
- * Software distributed under the License is distributed on an “AS IS” basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
6
- *
7
- * The Original Code is manuscripts-frontend.
8
- *
9
- * The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
10
- *
11
- * All portions of the code written by Atypon Systems LLC are Copyright (c) 2019 Atypon Systems LLC. All Rights Reserved.
12
- */
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- const json_schema_1 = require("@manuscripts/json-schema");
15
- const transform_1 = require("@manuscripts/transform");
16
- const react_1 = require("react");
17
- const node_attrs_1 = require("../lib/node-attrs");
18
- const store_1 = require("../store");
19
- const adapt_tracked_data_1 = require("./adapt-tracked-data");
20
- const creators_1 = require("./creators");
21
- const useTrackedModelManagement = (doc, view, state, dispatch, saveModel, deleteModel, finalModelMap) => {
22
- const modelMap = (0, react_1.useMemo)(() => {
23
- const adaptedDoc = (0, adapt_tracked_data_1.adaptTrackedData)(doc.toJSON());
24
- return (0, transform_1.encode)(transform_1.schema.nodeFromJSON(adaptedDoc));
25
- // eslint-disable-next-line react-hooks/exhaustive-deps
26
- }, [doc, finalModelMap]);
27
- const [, dispatchStore] = (0, store_1.useStore)();
28
- const saveCommentNode = (0, react_1.useCallback)((comment, view) => (0, creators_1.saveComment)(comment, view, doc, state, modelMap), [doc, modelMap, state]);
29
- const deleteCommentNode = (0, react_1.useCallback)((comment, view) => (0, creators_1.deleteComment)(comment, view, doc, state), [doc, state]);
30
- const saveTrackModel = (0, react_1.useCallback)((model) => {
31
- if (!view) {
32
- throw Error('View not available');
33
- }
34
- if (model.objectType === json_schema_1.ObjectTypes.CommentAnnotation) {
35
- return saveCommentNode(model, view);
36
- }
37
- if (model.objectType === json_schema_1.ObjectTypes.Supplement) {
38
- return (0, creators_1.createSupplementNode)(view, model);
39
- }
40
- if (model._id) {
41
- const currentModel = modelMap.get(model._id);
42
- if (currentModel) {
43
- modelMap.set(model._id, { ...currentModel, ...model });
44
- }
45
- else {
46
- modelMap.set(model._id, model);
47
- }
48
- let foundInDoc = false;
49
- if (view) {
50
- doc.descendants((node, pos) => {
51
- if (node.attrs.id === model._id) {
52
- const decoder = new transform_1.Decoder(modelMap, true); // as node ids are unique it will always occur just once (or never) so it's safe to keep in the loop
53
- const newDoc = decoder.createArticleNode();
54
- newDoc.descendants((newNode, pos) => {
55
- if (newNode.attrs.id === node.attrs.id) {
56
- (0, node_attrs_1.setNodeAttrs)(view.state, view.dispatch, node.attrs.id, {
57
- ...newNode.attrs,
58
- id: node.attrs.id,
59
- });
60
- }
61
- });
62
- foundInDoc = true;
63
- }
64
- });
65
- }
66
- if (!foundInDoc) {
67
- if (model.objectType === json_schema_1.ObjectTypes.Contributor) {
68
- (0, creators_1.createContributorNode)(model, view, doc, state);
69
- }
70
- else if (model.objectType === json_schema_1.ObjectTypes.Affiliation) {
71
- (0, creators_1.createAffiliationNode)(model, view, doc, state);
72
- }
73
- else {
74
- // ...that is if there is no node in the prosemirror doc for that id,
75
- // that update final model.
76
- // This is needed until we move all the data into prosemirror
77
- saveModel(model);
78
- }
79
- }
80
- }
81
- return Promise.resolve(model);
82
- },
83
- // eslint-disable-next-line react-hooks/exhaustive-deps
84
- [modelMap, saveModel, doc, view]);
85
- const deleteTrackModel = (0, react_1.useCallback)((id) => {
86
- if (!view) {
87
- throw Error('View not available');
88
- }
89
- if (modelMap.get(id)?.objectType === json_schema_1.ObjectTypes.CommentAnnotation) {
90
- return deleteCommentNode(modelMap.get(id), view);
91
- }
92
- if (modelMap.get(id)?.objectType === json_schema_1.ObjectTypes.Supplement) {
93
- return (0, creators_1.deleteSupplementNode)(view, modelMap.get(id));
94
- }
95
- if (modelMap.has(id)) {
96
- doc.descendants((node, pos) => {
97
- if (node.attrs.id === id) {
98
- const { tr } = state;
99
- tr.delete(pos, pos + node.nodeSize);
100
- dispatch(tr);
101
- }
102
- });
103
- }
104
- else {
105
- deleteModel(id);
106
- }
107
- return Promise.resolve(id);
108
- },
109
- // eslint-disable-next-line react-hooks/exhaustive-deps
110
- [
111
- modelMap,
112
- deleteCommentNode,
113
- doc,
114
- view,
115
- state,
116
- dispatch,
117
- dispatchStore,
118
- deleteModel,
119
- ]);
120
- const getTrackModel = (0, react_1.useCallback)((id) => modelMap.get(id), [modelMap]);
121
- return {
122
- saveTrackModel,
123
- deleteTrackModel,
124
- trackModelMap: modelMap,
125
- getTrackModel,
126
- };
127
- };
128
- exports.default = useTrackedModelManagement;
129
- //# sourceMappingURL=use-tracked-model-management.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-tracked-model-management.js","sourceRoot":"","sources":["../../../src/tracked-models/use-tracked-model-management.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;AAEH,0DAOiC;AACjC,sDAO+B;AAE/B,iCAA4C;AAE5C,kDAAgD;AAChD,oCAAmC;AACnC,6DAAuD;AACvD,yCAOmB;AAEnB,MAAM,yBAAyB,GAAG,CAChC,GAAmB,EACnB,IAAsC,EACtC,KAAkB,EAClB,QAA0C,EAC1C,SAA4E,EAC5E,WAA4C,EAC5C,aAAiC,EACjC,EAAE;IACF,MAAM,QAAQ,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE;QAC5B,MAAM,UAAU,GAAG,IAAA,qCAAgB,EAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAA;QACjD,OAAO,IAAA,kBAAM,EAAC,kBAAM,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAA;QAC9C,uDAAuD;IACzD,CAAC,EAAE,CAAC,GAAG,EAAE,aAAa,CAAC,CAAC,CAAA;IAExB,MAAM,CAAC,EAAE,aAAa,CAAC,GAAG,IAAA,gBAAQ,GAAE,CAAA;IAEpC,MAAM,eAAe,GAAG,IAAA,mBAAW,EACjC,CAAC,OAA0B,EAAE,IAA0B,EAAE,EAAE,CACzD,IAAA,sBAAW,EAAC,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,CAAC,EAClD,CAAC,GAAG,EAAE,QAAQ,EAAE,KAAK,CAAC,CACvB,CAAA;IAED,MAAM,iBAAiB,GAAG,I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QACvB,aAAa;KACd,CAAA;AACH,CAAC,CAAA;AAED,kBAAe,yBAAyB,CAAA"}
@@ -1,14 +0,0 @@
1
- /*!
2
- * The contents of this file are subject to the Common Public Attribution License Version 1.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://mpapp-public.gitlab.io/manuscripts-frontend/LICENSE. The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B.
3
- *
4
- * Software distributed under the License is distributed on an “AS IS” basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
5
- *
6
- * The Original Code is manuscripts-frontend.
7
- *
8
- * The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
9
- *
10
- * All portions of the code written by Atypon Systems LLC are Copyright (c) 2019 Atypon Systems LLC. All Rights Reserved.
11
- */
12
- // TODO: use nullish coalescing instead
13
- export const valueOrDefault = (value, defaultValue) => (value === undefined ? defaultValue : value);
14
- //# sourceMappingURL=StyleFields.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"StyleFields.js","sourceRoot":"","sources":["../../../../src/components/inspector/StyleFields.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAMH,uCAAuC;AACvC,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,KAAoB,EACpB,YAAe,EACZ,EAAE,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA"}