@manuscripts/article-editor 3.1.1 → 3.1.2-JSR-2

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 (163) 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 +22 -118
  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 +9 -1
  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 -4
  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 +11 -27
  48. package/dist/cjs/postgres-data/buildData.js.map +1 -1
  49. package/dist/cjs/postgres-data/buildUtilities.js +0 -53
  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 +22 -95
  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 +9 -1
  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 -4
  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 +12 -28
  105. package/dist/es/postgres-data/buildData.js.map +1 -1
  106. package/dist/es/postgres-data/buildUtilities.js +1 -54
  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/{cjs/components/inspector/StyleFields.js → types/quarterback/api/loadDoc.d.ts} +8 -8
  132. package/dist/types/store/Store.d.ts +6 -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.map +0 -1
  136. package/dist/cjs/lib/sort.js +0 -17
  137. package/dist/cjs/lib/sort.js.map +0 -1
  138. package/dist/cjs/quarterback/QuarterBackDataSource.js +0 -29
  139. package/dist/cjs/quarterback/QuarterBackDataSource.js.map +0 -1
  140. package/dist/cjs/tracked-models/adapt-tracked-data.js +0 -100
  141. package/dist/cjs/tracked-models/adapt-tracked-data.js.map +0 -1
  142. package/dist/cjs/tracked-models/creators.js +0 -129
  143. package/dist/cjs/tracked-models/creators.js.map +0 -1
  144. package/dist/cjs/tracked-models/use-tracked-model-management.js +0 -129
  145. package/dist/cjs/tracked-models/use-tracked-model-management.js.map +0 -1
  146. package/dist/es/components/inspector/StyleFields.js +0 -14
  147. package/dist/es/components/inspector/StyleFields.js.map +0 -1
  148. package/dist/es/lib/sort.js +0 -13
  149. package/dist/es/lib/sort.js.map +0 -1
  150. package/dist/es/quarterback/QuarterBackDataSource.js +0 -26
  151. package/dist/es/quarterback/QuarterBackDataSource.js.map +0 -1
  152. package/dist/es/tracked-models/adapt-tracked-data.js +0 -95
  153. package/dist/es/tracked-models/adapt-tracked-data.js.map +0 -1
  154. package/dist/es/tracked-models/creators.js +0 -120
  155. package/dist/es/tracked-models/creators.js.map +0 -1
  156. package/dist/es/tracked-models/use-tracked-model-management.js +0 -127
  157. package/dist/es/tracked-models/use-tracked-model-management.js.map +0 -1
  158. package/dist/types/components/inspector/StyleFields.d.ts +0 -14
  159. package/dist/types/lib/sort.d.ts +0 -17
  160. package/dist/types/quarterback/QuarterBackDataSource.d.ts +0 -23
  161. package/dist/types/tracked-models/adapt-tracked-data.d.ts +0 -13
  162. package/dist/types/tracked-models/creators.d.ts +0 -21
  163. package/dist/types/tracked-models/use-tracked-model-management.d.ts +0 -21
@@ -0,0 +1,81 @@
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) 2022 Atypon Systems LLC. All Rights Reserved.
11
+ */
12
+ import { getVersion, schema } from '@manuscripts/transform';
13
+ import { updateDocument } from './document';
14
+ import * as docApi from './document';
15
+ export async function loadDoc(manuscriptID, projectID, authToken, existingDoc) {
16
+ const resp = await docApi.getTransformVersion(authToken);
17
+ if ('data' in resp && resp.data.transformVersion !== getVersion()) {
18
+ console.warn(`Warning! Manuscripts-transform (Frontend: ${getVersion()}) version is different on manuscripts-api (${resp.data.transformVersion})`);
19
+ }
20
+ const found = await docApi.getDocument(projectID, manuscriptID, authToken);
21
+ let doc;
22
+ let version = 0;
23
+ let snapshots = [];
24
+ if ('data' in found) {
25
+ let empty = true;
26
+ for (const _ in found.data.doc) {
27
+ empty = false;
28
+ break;
29
+ }
30
+ if (empty) {
31
+ if (!existingDoc) {
32
+ throw new Error('Unable to produce valid doc as neither model based verions nor history have a valid version');
33
+ }
34
+ await docApi.updateDocument(projectID, manuscriptID, authToken, {
35
+ doc: existingDoc.toJSON(),
36
+ schema_version: getVersion(),
37
+ });
38
+ }
39
+ snapshots = found.data.snapshots;
40
+ doc = found.data.doc;
41
+ version = found.data.version;
42
+ }
43
+ else if ('err' in found && found.code === 404) {
44
+ // Create an empty doc that will be replaced with whatever document is currently being edited
45
+ const res = await docApi.createDocument({
46
+ manuscript_model_id: manuscriptID,
47
+ project_model_id: projectID,
48
+ doc: {},
49
+ schema_version: getVersion(),
50
+ }, authToken);
51
+ if ('data' in res) {
52
+ doc = res.data.doc;
53
+ version = res.data.version;
54
+ snapshots = res.data.snapshots;
55
+ }
56
+ if ('err' in res) {
57
+ console.error('Unable to create new document: ' + res.err);
58
+ }
59
+ const update = await updateDocument(projectID, manuscriptID, authToken, {
60
+ doc: existingDoc?.toJSON(),
61
+ schema_version: getVersion(),
62
+ });
63
+ if ('err' in update) {
64
+ console.error('Unable to create new document: ' + update.err);
65
+ }
66
+ else {
67
+ const found = await docApi.getDocument(projectID, manuscriptID, authToken);
68
+ if ('data' in found && found.data.doc && found.data.version >= 0) {
69
+ doc = found.data.doc;
70
+ version = found.data.version;
71
+ }
72
+ }
73
+ }
74
+ if (doc !== null &&
75
+ typeof doc === 'object' &&
76
+ Object.keys(doc).length !== 0) {
77
+ return { doc: schema.nodeFromJSON(doc), version, snapshots };
78
+ }
79
+ return undefined;
80
+ }
81
+ //# sourceMappingURL=loadDoc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadDoc.js","sourceRoot":"","sources":["../../../../src/quarterback/api/loadDoc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,UAAU,EAAkB,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAG3E,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAC3C,OAAO,KAAK,MAAM,MAAM,YAAY,CAAA;AAEpC,MAAM,CAAC,KAAK,UAAU,OAAO,CAC3B,YAAoB,EACpB,SAAiB,EACjB,SAAiB,EACjB,WAA4B;IAE5B,MAAM,IAAI,GAAG,MAAM,MAAM,CA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ACN,OAAO,EACP,IAAI,CAAC,KAAM,EACX,IAAI,CAAC,QAAQ,CACd,CAAA;QACD,IAAI,kBAAkB,EAAE;YACtB,IAAI,CAAC,QAAQ,CACX,IAAI,CAAC,OAAO,CACV,kBAAkB,CAAC,OAAO,EAC1B,IAAI,CAAC,KAAM,EACX,kBAAkB,CAAC,MAAM,IAAI,EAAE,CAChC,CACF,CAAA;SACF;IACH,CAAC;IACD,OAAO;QACL,IAAI,IAAI,CAAC,cAAc,EAAE;YACvB,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,KAAM,CAAC,CAAA;SACjC;QACD,IAAI,IAAI,CAAC,OAAO,EAAE;YAChB,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC,CAAA;SACrE;QACD,IAAI,CAAC,OAAO,GAAG,EAAE,CAAA;QACjB,IAAI,CAAC,KAAK,GAAG,EAAW,CAAA;QACxB,IAAI,CAAC,KAAK,GAAG,IAAI,GAAG,EAAE,CAAA;IACxB,CAAC;CACF"}
@@ -22,7 +22,7 @@ export const GenericStoreProvider = ({ children, store }) => {
22
22
  return () => store.unmount();
23
23
  }, [store]);
24
24
  if (store) {
25
- return (React.createElement(GenericStoreContext.Provider, { value: store }, store.state?.project ? children : React.createElement("p", null, "Project was not found")));
25
+ return (React.createElement(GenericStoreContext.Provider, { value: store }, store.state?.doc ? children : React.createElement("p", null, "Project was not found")));
26
26
  }
27
27
  return null;
28
28
  };
@@ -1 +1 @@
1
- {"version":3,"file":"StoreContext.js","sourceRoot":"","sources":["../../../src/store/StoreContext.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEnE,OAAO,EAAE,YAAY,EAA2B,MAAM,GAAG,CAAA;AAEzD,MAAM,mBAA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AAE,CAAA;IAChC,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IACzB,OAAO,KAAK,CAAA;AACd,CAAC,CAAA;AAOD,MAAM,CAAC,MAAM,oBAAoB,GAAoB,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAE;IAC3E,SAAS,CAAC,GAAG,EAAE;QACb,OAAO,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,CAAA;IAC9B,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAA;IAEX,IAAI,KAAK,EAAE;QACT,OAAO,CACL,oBAAC,mBAAmB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,IACvC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,uDAA4B,CAC9B,CAChC,CAAA;KACF;IACD,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAA"}
@@ -18,4 +18,9 @@ export const useStore = (selector) => {
18
18
  const state = useSyncExternalStoreWithSelector(store.subscribe, () => store.getState(), undefined, init, deeperEqual);
19
19
  return [state, store.dispatchAction, store.getState, store.subscribe];
20
20
  };
21
+ // Allows to get store's state on demand rather than subscribing to it
22
+ export const useGetState = () => {
23
+ const store = useGenericStore();
24
+ return store.getState;
25
+ };
21
26
  //# sourceMappingURL=useStore.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useStore.js","sourceRoot":"","sources":["../../../src/store/useStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,gCAAgC,EAAE,MAAM,uCAAuC,CAAA;AAExF,OAAO,WAAW,MAAM,qBAAqB,CAAA;AAE7C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAIhD,MAAM,CAAC,MAAM,QAAQ,GAAG,CACtB,QAAsB,EAC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,EAAE,KAAK,CAAC,SAAS,CAAC,CAAA;AACvE,CAAC,CAAA;AAED,sEAAsE;AACtE,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,EAAE;IAC9B,MAAM,KAAK,GAAG,eAAe,EAAE,CAAA;IAC/B,OAAO,KAAK,CAAC,QAAQ,CAAA;AACvB,CAAC,CAAA"}
@@ -9,11 +9,9 @@
9
9
  *
10
10
  * All portions of the code written by Atypon Systems LLC are Copyright (c) 2019 Atypon Systems LLC. All Rights Reserved.
11
11
  */
12
- import { Project } from '@manuscripts/json-schema';
13
12
  import React from 'react';
14
13
  export declare const Main: import("styled-components").StyledComponent<"main", import("styled-components").DefaultTheme, {}, never>;
15
14
  export declare const Centered: import("styled-components").StyledComponent<"main", import("styled-components").DefaultTheme, {}, never>;
16
- export declare const Page: React.FunctionComponent<{
15
+ export declare const Page: React.FC<{
17
16
  children: React.ReactNode;
18
- project?: Project;
19
17
  }>;
@@ -1,22 +1,8 @@
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
- import { Section } from '@manuscripts/json-schema';
13
1
  import { SectionNode } from '@manuscripts/transform';
14
2
  import { EditorState, Transaction } from 'prosemirror-state';
15
3
  import React from 'react';
16
4
  export declare const SectionInspector: React.FC<{
17
5
  dispatchNodeAttrs: (id: string, attrs: Record<string, unknown>, nodispatch?: boolean) => Transaction | undefined;
18
- section: Section;
19
- sectionNode?: SectionNode;
6
+ section: SectionNode;
20
7
  state: EditorState;
21
- dispatch: (tr: Transaction) => EditorState | void;
22
8
  }>;
@@ -1,6 +1,2 @@
1
- import { EditorState, Transaction } from 'prosemirror-state';
2
1
  import React from 'react';
3
- export declare const ContentTab: React.FC<{
4
- state: EditorState;
5
- dispatch: (tr: Transaction) => EditorState;
6
- }>;
2
+ export declare const ContentTab: React.FC;
@@ -1,18 +1,3 @@
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) 2021 Atypon Systems LLC. All Rights Reserved.
11
- */
12
- import { useEditor } from '@manuscripts/body-editor';
13
1
  import React from 'react';
14
- interface Props {
15
- editor: ReturnType<typeof useEditor>;
16
- }
17
- declare const EditorElement: React.FC<Props>;
2
+ declare const EditorElement: React.FC;
18
3
  export default EditorElement;
@@ -10,9 +10,5 @@
10
10
  * All portions of the code written by Atypon Systems LLC are Copyright (c) 2023 Atypon Systems LLC. All Rights Reserved.
11
11
  */
12
12
  import React from 'react';
13
- import { useCreateEditor } from '../../hooks/use-create-editor';
14
- interface Props {
15
- editor: ReturnType<typeof useCreateEditor>;
16
- }
17
- declare const Inspector: React.FC<Props>;
13
+ declare const Inspector: React.FC;
18
14
  export default Inspector;
@@ -9,10 +9,5 @@
9
9
  *
10
10
  * All portions of the code written by Atypon Systems LLC are Copyright (c) 2019 Atypon Systems LLC. All Rights Reserved.
11
11
  */
12
- import { useEditor } from '@manuscripts/body-editor';
13
12
  import React from 'react';
14
- interface ApplicationMenusProps {
15
- editor: ReturnType<typeof useEditor>;
16
- }
17
- export declare const ManuscriptMenus: React.FC<ApplicationMenusProps>;
18
- export {};
13
+ export declare const ManuscriptMenus: React.FC;
@@ -14,7 +14,7 @@ import '@manuscripts/body-editor/styles/AdvancedEditor.css';
14
14
  import '@manuscripts/body-editor/styles/popper.css';
15
15
  import '@reach/tabs/styles.css';
16
16
  import React from 'react';
17
+ declare const ManuscriptPageContainer: React.FC;
17
18
  export declare const ManuscriptMenusContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
18
19
  export declare const ManuscriptMenusContainerInner: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
19
- declare const ManuscriptPageContainer: React.FC;
20
20
  export default ManuscriptPageContainer;
@@ -9,14 +9,6 @@
9
9
  *
10
10
  * All portions of the code written by Atypon Systems LLC are Copyright (c) 2019 Atypon Systems LLC. All Rights Reserved.
11
11
  */
12
- import { useEditor } from '@manuscripts/body-editor';
13
- import { Manuscript } from '@manuscripts/json-schema';
14
- import { ManuscriptEditorView } from '@manuscripts/transform';
15
12
  import React from 'react';
16
- interface Props {
17
- state: ReturnType<typeof useEditor>['state'];
18
- manuscript: Manuscript;
19
- view?: ManuscriptEditorView;
20
- }
21
- declare const ManuscriptSidebar: React.FC<Props>;
13
+ declare const ManuscriptSidebar: React.FC;
22
14
  export default ManuscriptSidebar;
@@ -9,14 +9,8 @@
9
9
  *
10
10
  * All portions of the code written by Atypon Systems LLC are Copyright (c) 2024 Atypon Systems LLC. All Rights Reserved.
11
11
  */
12
- import { ManuscriptEditorState, ManuscriptEditorView } from '@manuscripts/transform';
13
- import { Transaction } from 'prosemirror-state';
14
12
  import React from 'react';
15
13
  export declare const ToolbarItem: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
16
14
  export declare const ToolbarContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
17
15
  export declare const ToolbarGroup: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
18
- export declare const ManuscriptToolbar: React.FC<{
19
- state: ManuscriptEditorState;
20
- dispatch: (tr: Transaction) => void;
21
- view?: ManuscriptEditorView;
22
- }>;
16
+ export declare const ManuscriptToolbar: React.FC;
@@ -21,6 +21,6 @@ export interface SuggestionListProps {
21
21
  onReject(change: TrackedChange): void;
22
22
  onReset(change: TrackedChange): void;
23
23
  onAcceptAll?(): void;
24
- onSelect(change: TrackedChange): void;
24
+ onSelect?(change: TrackedChange): void;
25
25
  }
26
26
  export declare const SuggestionList: React.FC<SuggestionListProps>;
@@ -9,5 +9,9 @@
9
9
  *
10
10
  * All portions of the code written by Atypon Systems LLC are Copyright (c) 2022 Atypon Systems LLC. All Rights Reserved.
11
11
  */
12
- export declare const trackedJoint = ":dataTracked:";
13
- export declare const stripTracked: (id: string) => string;
12
+ import { CHANGE_STATUS, TrackedChange } from '@manuscripts/track-changes-plugin';
13
+ import { Command } from 'prosemirror-state';
14
+ import { EditorView } from 'prosemirror-view';
15
+ import { state } from '../../store';
16
+ export declare const setSelectedSuggestion: (suggestion: TrackedChange, getState: () => state) => void;
17
+ export declare const setChangeStatus: (change: TrackedChange, status: CHANGE_STATUS, execCmd: (cmd: Command, hookView?: EditorView) => void) => void;
@@ -0,0 +1,9 @@
1
+ export declare const useConnectEditor: () => {
2
+ state: import("prosemirror-state").EditorState;
3
+ onRender: (el: HTMLDivElement | null) => void;
4
+ isCommandValid: (command: import("prosemirror-state").Command) => boolean;
5
+ doCommand: (command: import("prosemirror-state").Command) => boolean;
6
+ replaceState: (state: import("prosemirror-state").EditorState) => void;
7
+ view: import("prosemirror-view").EditorView | undefined;
8
+ dispatch: (tr: import("prosemirror-state").Transaction) => import("prosemirror-state").EditorState;
9
+ };
@@ -10,14 +10,13 @@
10
10
  * All portions of the code written by Atypon Systems LLC are Copyright (c) 2023 Atypon Systems LLC. All Rights Reserved.
11
11
  */
12
12
  import { FileAttachment } from '@manuscripts/body-editor';
13
- import { Affiliation, BibliographyItem, Footnote } from '@manuscripts/json-schema';
14
13
  import { NodeAttrChange } from '@manuscripts/track-changes-plugin';
15
- import { ManuscriptNode } from '@manuscripts/transform';
14
+ import { AffiliationNode, BibliographyItemNode, FootnoteNode, ManuscriptNode } from '@manuscripts/transform';
16
15
  /**
17
16
  * Filter PN node attributes to show for comparing them with old change
18
17
  * @param attrsChange
19
18
  */
20
- export declare const filterAttrsChange: (modelOfChange: ManuscriptNode, attrsChange: NodeAttrChange, files: FileAttachment[], affiliations: Affiliation[], references: BibliographyItem[], footnotes: Footnote[]) => {
19
+ export declare const filterAttrsChange: (modelOfChange: ManuscriptNode, attrsChange: NodeAttrChange, files: FileAttachment[], affiliations: AffiliationNode[], references: BibliographyItemNode[], footnotes: FootnoteNode[]) => {
21
20
  newAttrs: Record<string, {
22
21
  label: string;
23
22
  value: string;
@@ -9,5 +9,5 @@
9
9
  *
10
10
  * All portions of the code written by Atypon Systems LLC are Copyright (c) 2019 Atypon Systems LLC. All Rights Reserved.
11
11
  */
12
- declare const deeperEqual: (prev: any, next: any) => boolean;
12
+ declare const deeperEqual: (next: any, prev: any) => boolean;
13
13
  export default deeperEqual;
@@ -9,18 +9,18 @@
9
9
  *
10
10
  * All portions of the code written by Atypon Systems LLC are Copyright (c) 2020 Atypon Systems LLC. All Rights Reserved.
11
11
  */
12
- import { Section, SectionCategory } from '@manuscripts/json-schema';
13
- import { ManuscriptNode } from '@manuscripts/transform';
12
+ import { SectionCategory } from '@manuscripts/json-schema';
13
+ import { ManuscriptNode, SectionNode } from '@manuscripts/transform';
14
14
  export declare const uneditableSectionCategories: string[];
15
15
  export declare const uniqueSectionCategories: string[];
16
16
  export declare const isEditableSectionCategoryID: (id: string) => boolean;
17
17
  export declare const isEditableSectionCategory: (sectionCategory: SectionCategory) => boolean;
18
18
  export declare const sortSectionCategories: (sectionCategories: SectionCategory[]) => SectionCategory[];
19
- export declare const chooseSectionCategory: (section: Section) => string;
19
+ export declare const chooseSectionCategory: (section: SectionNode, isSubSection?: boolean) => string;
20
20
  export declare const isUnique: (categoryId: string) => boolean;
21
21
  export declare const isUniqueCurrent: (categoryId: string, currentCategoryId: string) => boolean;
22
22
  export declare const isUniquePresent: (cat: SectionCategory, existingCats: {
23
23
  [key: string]: number;
24
24
  }) => boolean;
25
25
  export declare const isBackMatterSection: (groupId: string) => boolean;
26
- export declare const isBackMatterSectionCategoryExist: (parent: ManuscriptNode, category: string) => boolean;
26
+ export declare const backMatterSectionCategoryExist: (parent: ManuscriptNode, category: string) => boolean;
@@ -1,2 +1,3 @@
1
+ import { ManuscriptNode } from '@manuscripts/transform';
1
2
  import Api from './Api';
2
- export declare const buildData: (projectID: string, manuscriptID: string, api: Api) => Promise<{}>;
3
+ export declare const buildData: (projectID: string, manuscriptID: string, doc: ManuscriptNode, api: Api) => Promise<{}>;
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  /*!
3
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.
4
3
  *
@@ -8,11 +7,12 @@
8
7
  *
9
8
  * The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
10
9
  *
11
- * All portions of the code written by Atypon Systems LLC are Copyright (c) 2019 Atypon Systems LLC. All Rights Reserved.
10
+ * All portions of the code written by Atypon Systems LLC are Copyright (c) 2022 Atypon Systems LLC. All Rights Reserved.
12
11
  */
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
12
+ import { ManuscriptNode } from '@manuscripts/transform';
13
+ import { SnapshotLabel } from '../types';
14
+ export declare function loadDoc(manuscriptID: string, projectID: string, authToken: string, existingDoc?: ManuscriptNode): Promise<{
15
+ doc: import("prosemirror-model").Node;
16
+ version: number;
17
+ snapshots: SnapshotLabel[];
18
+ } | undefined>;
@@ -10,9 +10,9 @@
10
10
  * All portions of the code written by Atypon Systems LLC are Copyright (c) 2019 Atypon Systems LLC. All Rights Reserved.
11
11
  */
12
12
  import { CommentKey, FileAttachment, FileManagement } from '@manuscripts/body-editor';
13
- import { Manuscript, Model, Project, SectionCategory, UserProfile } from '@manuscripts/json-schema';
13
+ import { Project, SectionCategory, UserProfile } from '@manuscripts/json-schema';
14
14
  import { TrackChangesState } from '@manuscripts/track-changes-plugin';
15
- import { Build, ManuscriptEditorView, ManuscriptNode } from '@manuscripts/transform';
15
+ import { ManuscriptEditorView, ManuscriptNode } from '@manuscripts/transform';
16
16
  import { useCreateEditor } from '../hooks/use-create-editor';
17
17
  import { ManuscriptSnapshot, SnapshotLabel } from '../quarterback/types';
18
18
  import { StoreDataSourceStrategy } from '.';
@@ -26,33 +26,25 @@ export interface ContainerIDs {
26
26
  manuscriptID?: string;
27
27
  templateID?: string;
28
28
  }
29
+ export type PMEditor = ReturnType<typeof useCreateEditor>;
29
30
  export type state = {
30
31
  [key: string]: any;
31
32
  manuscriptID: string;
32
33
  projectID: string;
33
34
  userID?: string;
34
35
  project: Project;
35
- manuscript: Manuscript;
36
36
  user: UserProfile;
37
- editor: ReturnType<typeof useCreateEditor>;
37
+ editor: PMEditor;
38
38
  doc: ManuscriptNode;
39
+ trackState?: TrackChangesState;
40
+ view: ManuscriptEditorView;
39
41
  initialDocVersion: number;
40
- modelMap: Map<string, Model>;
41
- saveModel: <T extends Model>(model: T | Build<T> | Partial<T>) => Promise<T>;
42
- deleteModel: (id: string) => Promise<string>;
43
- saveModels: (models: Model[]) => Promise<void>;
44
- saveManuscript: (data: Partial<Manuscript>) => Promise<void>;
45
- saveTrackModel: <T extends Model>(model: T | Build<T> | Partial<T>) => Promise<T>;
46
- trackModelMap: Map<string, Model>;
47
- deleteTrackModel: (id: string) => Promise<string>;
48
42
  fileManagement: FileManagement;
49
43
  files: FileAttachment[];
50
44
  authToken: string;
51
45
  tokenData: TokenData;
52
46
  collaborators: Map<string, UserProfile>;
53
47
  collaboratorsById: Map<string, UserProfile>;
54
- trackState?: TrackChangesState;
55
- view: ManuscriptEditorView;
56
48
  snapshots: SnapshotLabel[];
57
49
  snapshotsMap: Map<string, ManuscriptSnapshot>;
58
50
  createSnapshot: () => Promise<void>;
@@ -12,4 +12,5 @@
12
12
  import { dispatch, GenericStore, state } from './Store';
13
13
  type Selector<T> = (r: state) => state | T;
14
14
  export declare const useStore: <T>(selector?: Selector<T> | undefined) => [T, dispatch, () => state, (fn: (state: state, prev: state) => void) => () => void];
15
+ export declare const useGetState: () => () => state;
15
16
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manuscripts/article-editor",
3
- "version": "3.1.1",
3
+ "version": "3.1.2-JSR-2",
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.10",
38
+ "@manuscripts/body-editor": "2.0.11-JSR",
39
39
  "@manuscripts/json-schema": "2.2.10",
40
40
  "@manuscripts/library": "1.3.10",
41
- "@manuscripts/style-guide": "2.0.1",
41
+ "@manuscripts/style-guide": "2.0.2",
42
42
  "@manuscripts/track-changes-plugin": "1.7.17",
43
- "@manuscripts/transform": "2.3.21",
43
+ "@manuscripts/transform": "2.3.21-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 +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"}