@manuscripts/article-editor 1.5.5-LEAN-2702 → 1.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/src/EditorApp.js +8 -4
- package/dist/cjs/src/EditorApp.js.map +1 -1
- package/dist/cjs/src/components/projects/CommentList.js +3 -6
- package/dist/cjs/src/components/projects/CommentList.js.map +1 -1
- package/dist/cjs/src/components/projects/ManuscriptPageContainer.js +20 -4
- package/dist/cjs/src/components/projects/ManuscriptPageContainer.js.map +1 -1
- package/dist/cjs/src/hooks/use-create-editor.js +2 -7
- package/dist/cjs/src/hooks/use-create-editor.js.map +1 -1
- package/dist/cjs/src/quarterback/api/document.js +1 -20
- package/dist/cjs/src/quarterback/api/document.js.map +1 -1
- package/dist/cjs/src/quarterback/api/methods.js +1 -44
- package/dist/cjs/src/quarterback/api/methods.js.map +1 -1
- package/dist/cjs/src/quarterback/api/methodsV2.js +1 -39
- package/dist/cjs/src/quarterback/api/methodsV2.js.map +1 -1
- package/dist/cjs/src/quarterback/useDocStore.js +0 -33
- package/dist/cjs/src/quarterback/useDocStore.js.map +1 -1
- package/dist/cjs/src/quarterback/useLoadDoc.js +3 -19
- package/dist/cjs/src/quarterback/useLoadDoc.js.map +1 -1
- package/dist/cjs/src/store/Store.js.map +1 -1
- package/dist/es/src/EditorApp.js +8 -4
- package/dist/es/src/EditorApp.js.map +1 -1
- package/dist/es/src/components/projects/CommentList.js +3 -6
- package/dist/es/src/components/projects/CommentList.js.map +1 -1
- package/dist/es/src/components/projects/ManuscriptPageContainer.js +20 -4
- package/dist/es/src/components/projects/ManuscriptPageContainer.js.map +1 -1
- package/dist/es/src/hooks/use-create-editor.js +2 -7
- package/dist/es/src/hooks/use-create-editor.js.map +1 -1
- package/dist/es/src/quarterback/api/document.js +1 -17
- package/dist/es/src/quarterback/api/document.js.map +1 -1
- package/dist/es/src/quarterback/api/methods.js +0 -40
- package/dist/es/src/quarterback/api/methods.js.map +1 -1
- package/dist/es/src/quarterback/api/methodsV2.js +0 -37
- package/dist/es/src/quarterback/api/methodsV2.js.map +1 -1
- package/dist/es/src/quarterback/useDocStore.js +0 -30
- package/dist/es/src/quarterback/useDocStore.js.map +1 -1
- package/dist/es/src/quarterback/useLoadDoc.js +3 -19
- package/dist/es/src/quarterback/useLoadDoc.js.map +1 -1
- package/dist/es/src/store/Store.js.map +1 -1
- package/dist/types/src/quarterback/api/document.d.ts +2 -6
- package/dist/types/src/quarterback/api/methods.d.ts +0 -3
- package/dist/types/src/quarterback/api/methodsV2.d.ts +0 -2
- package/dist/types/src/quarterback/useDocStore.d.ts +15 -6
- package/dist/types/src/quarterback/useLoadDoc.d.ts +1 -5
- package/dist/types/src/store/Store.d.ts +0 -1
- package/package.json +4 -6
- package/dist/cjs/src/quarterback/QuarterBackDataSource.js +0 -25
- package/dist/cjs/src/quarterback/QuarterBackDataSource.js.map +0 -1
- package/dist/cjs/src/quarterback/QuarterbackStepsExchanger.js +0 -80
- package/dist/cjs/src/quarterback/QuarterbackStepsExchanger.js.map +0 -1
- package/dist/cjs/src/quarterback/types.js +0 -3
- package/dist/cjs/src/quarterback/types.js.map +0 -1
- package/dist/es/src/quarterback/QuarterBackDataSource.js +0 -22
- package/dist/es/src/quarterback/QuarterBackDataSource.js.map +0 -1
- package/dist/es/src/quarterback/QuarterbackStepsExchanger.js +0 -78
- package/dist/es/src/quarterback/QuarterbackStepsExchanger.js.map +0 -1
- package/dist/es/src/quarterback/types.js +0 -2
- package/dist/es/src/quarterback/types.js.map +0 -1
- package/dist/types/src/quarterback/QuarterBackDataSource.d.ts +0 -21
- package/dist/types/src/quarterback/QuarterbackStepsExchanger.d.ts +0 -32
- package/dist/types/src/quarterback/types.d.ts +0 -55
|
@@ -10,7 +10,6 @@
|
|
|
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
12
|
import type { Maybe } from '@manuscripts/quarterback-types';
|
|
13
|
-
import { EventSourceMessage } from '@microsoft/fetch-event-source';
|
|
14
13
|
type FetchOptions = {
|
|
15
14
|
method: string;
|
|
16
15
|
headers: Record<string, string>;
|
|
@@ -28,5 +27,4 @@ export declare function get<T>(path: string, authToken: string, defaultError?: s
|
|
|
28
27
|
export declare function post<T>(path: string, authToken: string, payload: any, defaultError?: string, headers?: Record<string, string>): Promise<Maybe<T>>;
|
|
29
28
|
export declare function put<T>(path: string, authToken: string, payload: any, defaultError?: string, headers?: Record<string, string>): Promise<Maybe<T>>;
|
|
30
29
|
export declare function del<T>(path: string, authToken: string, defaultError?: string, headers?: Record<string, string>): Promise<Maybe<T>>;
|
|
31
|
-
export declare function listen<T>(path: string, listener: (event: EventSourceMessage) => void, authToken: string, defaultError?: string, headers?: Record<string, string>): Promise<void>;
|
|
32
30
|
export {};
|
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 { ManuscriptDoc } from '@manuscripts/quarterback-types';
|
|
3
13
|
interface CurrentDocument {
|
|
4
14
|
manuscriptID: string;
|
|
5
15
|
projectID: string;
|
|
@@ -8,11 +18,10 @@ interface DocState {
|
|
|
8
18
|
currentDocument: CurrentDocument | null;
|
|
9
19
|
quarterbackDoc: ManuscriptDoc | null;
|
|
10
20
|
}
|
|
11
|
-
export declare const useDocStore: import("zustand").UseBoundStore<import("zustand").StoreApi<Omit<DocState, "setCurrentDocument" | "getDocument" | "createDocument" | "
|
|
21
|
+
export declare const useDocStore: import("zustand").UseBoundStore<import("zustand").StoreApi<Omit<DocState, "setCurrentDocument" | "getDocument" | "createDocument" | "updateDocument" | "deleteDocument"> & {
|
|
12
22
|
setCurrentDocument: (manuscriptID: string, projectID: string) => void;
|
|
13
|
-
getDocument: (projectID: string, manuscriptID: string, authToken: string) => Promise<import("@manuscripts/quarterback-types").Maybe<import("
|
|
14
|
-
createDocument: (manuscriptID: string, projectID: string, authToken: string) => Promise<import("@manuscripts/quarterback-types").Maybe<import("
|
|
15
|
-
stepsExchanger(docId: string, projectId: string, lastVersion: number, authToken: string, isAuthed?: boolean): QuarterbackStepsExchanger | undefined;
|
|
23
|
+
getDocument: (projectID: string, manuscriptID: string, authToken: string) => Promise<import("@manuscripts/quarterback-types").Maybe<import("@manuscripts/quarterback-types").ManuscriptDocWithSnapshots>>;
|
|
24
|
+
createDocument: (manuscriptID: string, projectID: string, authToken: string) => Promise<import("@manuscripts/quarterback-types").Maybe<import("@manuscripts/quarterback-types").ManuscriptDocWithSnapshots>>;
|
|
16
25
|
updateDocument: (projectID: string, manuscriptID: string, doc: Record<string, any>, authToken: string) => Promise<import("@manuscripts/quarterback-types").Maybe<boolean>>;
|
|
17
26
|
deleteDocument: (projectID: string, manuscriptID: string, authToken: string) => Promise<import("@manuscripts/quarterback-types").Maybe<boolean>>;
|
|
18
27
|
}>>;
|
|
@@ -9,8 +9,4 @@
|
|
|
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
|
-
|
|
13
|
-
export declare const useLoadDoc: (authToken: string) => (manuscriptID: string, projectID: string, existingDoc: ManuscriptNode) => Promise<{
|
|
14
|
-
doc: import("prosemirror-model").Node;
|
|
15
|
-
version: number;
|
|
16
|
-
} | undefined>;
|
|
12
|
+
export declare const useLoadDoc: (authToken: string) => (manuscriptID: string, projectID: string) => Promise<import("prosemirror-model").Node | undefined>;
|
|
@@ -53,7 +53,6 @@ export type state = {
|
|
|
53
53
|
user: UserProfile;
|
|
54
54
|
editor: ReturnType<typeof useCreateEditor>;
|
|
55
55
|
doc: ManuscriptNode;
|
|
56
|
-
initialDocVersion: number;
|
|
57
56
|
ancestorDoc: ManuscriptNode;
|
|
58
57
|
modelMap: Map<string, Model>;
|
|
59
58
|
saveModel: <T extends Model>(model: T | Build<T> | Partial<T>) => Promise<T>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manuscripts/article-editor",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.6",
|
|
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",
|
|
@@ -37,15 +37,14 @@
|
|
|
37
37
|
"@fontsource/pt-sans": "^4.5.11",
|
|
38
38
|
"@fontsource/pt-serif": "^4.5.11",
|
|
39
39
|
"@manuscripts/assets": "^0.6.4",
|
|
40
|
-
"@manuscripts/body-editor": "1.5.
|
|
40
|
+
"@manuscripts/body-editor": "^1.5.6",
|
|
41
41
|
"@manuscripts/json-schema": "^2.2.0",
|
|
42
42
|
"@manuscripts/library": "1.2.1",
|
|
43
43
|
"@manuscripts/quarterback-types": "^1.0.0",
|
|
44
|
-
"@manuscripts/style-guide": "1.4.
|
|
44
|
+
"@manuscripts/style-guide": "^1.4.3",
|
|
45
45
|
"@manuscripts/title-editor": "^1.1.0",
|
|
46
46
|
"@manuscripts/track-changes-plugin": "^1.7.3",
|
|
47
47
|
"@manuscripts/transform": "1.5.2",
|
|
48
|
-
"@microsoft/fetch-event-source": "^2.0.1",
|
|
49
48
|
"@reach/tabs": "^0.11.2",
|
|
50
49
|
"autotrack": "^2.4.1",
|
|
51
50
|
"axios": "^1.2.2",
|
|
@@ -77,7 +76,6 @@
|
|
|
77
76
|
"react-spring": "^8.0.25",
|
|
78
77
|
"react-tooltip": "^4.2.10",
|
|
79
78
|
"styled-components": "^5.2.0",
|
|
80
|
-
"type-fest": "^4.6.0",
|
|
81
79
|
"uuid": "^9.0.0",
|
|
82
80
|
"workbox-window": "^6.5.4",
|
|
83
81
|
"zustand": "^4.2.0"
|
|
@@ -180,4 +178,4 @@
|
|
|
180
178
|
"resolutions": {
|
|
181
179
|
"@types/react": "^17.0.2"
|
|
182
180
|
}
|
|
183
|
-
}
|
|
181
|
+
}
|
|
@@ -1,25 +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 && state.doc) {
|
|
7
|
-
const res = await this.loadDoc(state.manuscriptID, state.projectID, state.doc);
|
|
8
|
-
if (res?.doc && res.version) {
|
|
9
|
-
if (res.doc) {
|
|
10
|
-
next({
|
|
11
|
-
...state,
|
|
12
|
-
doc: res.doc,
|
|
13
|
-
initialDocVersion: res.version,
|
|
14
|
-
});
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
next(state);
|
|
20
|
-
};
|
|
21
|
-
this.loadDoc = loadDoc;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
exports.default = QuarterbackDataSource;
|
|
25
|
-
//# sourceMappingURL=QuarterBackDataSource.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"QuarterBackDataSource.js","sourceRoot":"","sources":["../../../../src/quarterback/QuarterBackDataSource.ts"],"names":[],"mappings":";;AAeA,MAAqB,qBAAqB;IAMxC,YAAY,OAAyC;QAGrD,UAAK,GAAc,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;YACvC,IAAI,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC,YAAY,IAAI,KAAK,CAAC,GAAG,EAAE;gBACtD,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,EAAE;oBAC3B,IAAI,GAAG,CAAC,GAAG,EAAE;wBACX,IAAI,CAAC;4BACH,GAAG,KAAK;4BACR,GAAG,EAAE,GAAG,CAAC,GAAG;4BACZ,iBAAiB,EAAE,GAAG,CAAC,OAAO;yBAC/B,CAAC,CAAA;wBACF,OAAM;qBACP;iBACF;aACF;YACD,IAAI,CAAC,KAAK,CAAC,CAAA;QACb,CAAC,CAAA;QArBC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;CAqBF;AA7BD,wCA6BC"}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/*!
|
|
4
|
-
* 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.
|
|
5
|
-
*
|
|
6
|
-
* 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.
|
|
7
|
-
*
|
|
8
|
-
* The Original Code is manuscripts-frontend.
|
|
9
|
-
*
|
|
10
|
-
* The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
|
|
11
|
-
*
|
|
12
|
-
* All portions of the code written by Atypon Systems LLC are Copyright (c) 2022 Atypon Systems LLC. All Rights Reserved.
|
|
13
|
-
*/
|
|
14
|
-
const body_editor_1 = require("@manuscripts/body-editor");
|
|
15
|
-
const transform_1 = require("@manuscripts/transform");
|
|
16
|
-
const prosemirror_transform_1 = require("prosemirror-transform");
|
|
17
|
-
const savingUtilities_1 = require("../postgres-data/savingUtilities");
|
|
18
|
-
class QuarterbackStepsExchanger extends body_editor_1.CollabProvider {
|
|
19
|
-
constructor(docId, projectId, startingVersion, applySteps, getStepsSince, listenToSteps, authToken) {
|
|
20
|
-
if (QuarterbackStepsExchanger._instance) {
|
|
21
|
-
return QuarterbackStepsExchanger._instance;
|
|
22
|
-
}
|
|
23
|
-
super();
|
|
24
|
-
QuarterbackStepsExchanger._instance = this;
|
|
25
|
-
this.applySteps = applySteps;
|
|
26
|
-
this.docId = docId;
|
|
27
|
-
this.projectId = projectId;
|
|
28
|
-
this.currentVersion = startingVersion;
|
|
29
|
-
this.getStepsSince = getStepsSince;
|
|
30
|
-
this.sendSteps = this.sendSteps.bind(this);
|
|
31
|
-
listenToSteps(docId, (version, jsonSteps, clientIDs) => {
|
|
32
|
-
if (!jsonSteps) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
const steps = this.hydrateSteps(jsonSteps);
|
|
36
|
-
if (steps.length) {
|
|
37
|
-
this.newStepsListener(version, steps, clientIDs);
|
|
38
|
-
}
|
|
39
|
-
}, authToken);
|
|
40
|
-
}
|
|
41
|
-
destroy() {
|
|
42
|
-
QuarterbackStepsExchanger._instance = null;
|
|
43
|
-
}
|
|
44
|
-
hydrateSteps(jsonSteps) {
|
|
45
|
-
return jsonSteps.map((s) => prosemirror_transform_1.Step.fromJSON(transform_1.schema, s));
|
|
46
|
-
}
|
|
47
|
-
async sendSteps(version, steps, clientID) {
|
|
48
|
-
// Apply and accumulate new steps
|
|
49
|
-
const stepsJSON = [];
|
|
50
|
-
steps.forEach((step) => {
|
|
51
|
-
stepsJSON.push(step.toJSON());
|
|
52
|
-
});
|
|
53
|
-
this.currentVersion = version;
|
|
54
|
-
(0, savingUtilities_1.saveWithThrottle)(() => {
|
|
55
|
-
this.applySteps(this.docId, {
|
|
56
|
-
steps: stepsJSON,
|
|
57
|
-
version,
|
|
58
|
-
clientID,
|
|
59
|
-
});
|
|
60
|
-
}, 2000);
|
|
61
|
-
return Promise.resolve();
|
|
62
|
-
}
|
|
63
|
-
onNewSteps(listener) {
|
|
64
|
-
this.newStepsListener = listener;
|
|
65
|
-
}
|
|
66
|
-
async stepsSince(version) {
|
|
67
|
-
// retrieve the steps since the number of version given
|
|
68
|
-
const res = await this.getStepsSince(this.docId, version);
|
|
69
|
-
if (res) {
|
|
70
|
-
return {
|
|
71
|
-
steps: this.hydrateSteps(res.steps),
|
|
72
|
-
clientIDs: res.clientIDs,
|
|
73
|
-
version: res.version,
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
exports.default = QuarterbackStepsExchanger;
|
|
80
|
-
//# sourceMappingURL=QuarterbackStepsExchanger.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"QuarterbackStepsExchanger.js","sourceRoot":"","sources":["../../../../src/quarterback/QuarterbackStepsExchanger.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;GAUG;AACH,0DAAyD;AACzD,sDAA+C;AAC/C,iEAA4C;AAE5C,sEAAmE;AAGnE,MAAM,yBAA0B,SAAQ,4BAAc;IAkBpD,YACE,KAAa,EACb,SAAiB,EACjB,eAAuB,EACvB,UAAmD,EACnD,aAAyD,EACzD,aAQS,EACT,SAAiB;Q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,IAAI,CAAC,MAAM,EAAE,CAAC,CAAA;QAC/B,CAAC,CAAC,CAAA;QAEF,IAAI,CAAC,cAAc,GAAG,OAAO,CAAA;QAC7B,IAAA,kCAAgB,EAAC,GAAG,EAAE;YACpB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE;gBAC1B,KAAK,EAAE,SAAS;gBAChB,OAAO;gBACP,QAAQ;aACT,CAAC,CAAA;QACJ,CAAC,EAAE,IAAI,CAAC,CAAA;QACR,OAAO,OAAO,CAAC,OAAO,EAAE,CAAA;IAC1B,CAAC;IAED,UAAU,CAAC,QAA4C;QACrD,IAAI,CAAC,gBAAgB,GAAG,QAAQ,CAAA;IAClC,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,OAAe;QAC9B,uDAAuD;QACvD,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;QACzD,IAAI,GAAG,EAAE;YACP,OAAO;gBACL,KAAK,EAAE,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC;gBACnC,SAAS,EAAE,GAAG,CAAC,SAAS;gBACxB,OAAO,EAAE,GAAG,CAAC,OAAO;aACrB,CAAA;SACF;QACD,OAAM;IACR,CAAC;CACF;AAED,kBAAe,yBAAyB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/quarterback/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export default class QuarterbackDataSource {
|
|
2
|
-
constructor(loadDoc) {
|
|
3
|
-
this.build = async (state, next) => {
|
|
4
|
-
if (state.projectID && state.manuscriptID && state.doc) {
|
|
5
|
-
const res = await this.loadDoc(state.manuscriptID, state.projectID, state.doc);
|
|
6
|
-
if (res?.doc && res.version) {
|
|
7
|
-
if (res.doc) {
|
|
8
|
-
next({
|
|
9
|
-
...state,
|
|
10
|
-
doc: res.doc,
|
|
11
|
-
initialDocVersion: res.version,
|
|
12
|
-
});
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
next(state);
|
|
18
|
-
};
|
|
19
|
-
this.loadDoc = loadDoc;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=QuarterBackDataSource.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"QuarterBackDataSource.js","sourceRoot":"","sources":["../../../../src/quarterback/QuarterBackDataSource.ts"],"names":[],"mappings":"AAeA,MAAM,CAAC,OAAO,OAAO,qBAAqB;IAMxC,YAAY,OAAyC;QAGrD,UAAK,GAAc,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;YACvC,IAAI,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC,YAAY,IAAI,KAAK,CAAC,GAAG,EAAE;gBACtD,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,EAAE;oBAC3B,IAAI,GAAG,CAAC,GAAG,EAAE;wBACX,IAAI,CAAC;4BACH,GAAG,KAAK;4BACR,GAAG,EAAE,GAAG,CAAC,GAAG;4BACZ,iBAAiB,EAAE,GAAG,CAAC,OAAO;yBAC/B,CAAC,CAAA;wBACF,OAAM;qBACP;iBACF;aACF;YACD,IAAI,CAAC,KAAK,CAAC,CAAA;QACb,CAAC,CAAA;QArBC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;CAqBF"}
|
|
@@ -1,78 +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) 2022 Atypon Systems LLC. All Rights Reserved.
|
|
11
|
-
*/
|
|
12
|
-
import { CollabProvider } from '@manuscripts/body-editor';
|
|
13
|
-
import { schema } from '@manuscripts/transform';
|
|
14
|
-
import { Step } from 'prosemirror-transform';
|
|
15
|
-
import { saveWithThrottle } from '../postgres-data/savingUtilities';
|
|
16
|
-
class QuarterbackStepsExchanger extends CollabProvider {
|
|
17
|
-
constructor(docId, projectId, startingVersion, applySteps, getStepsSince, listenToSteps, authToken) {
|
|
18
|
-
if (QuarterbackStepsExchanger._instance) {
|
|
19
|
-
return QuarterbackStepsExchanger._instance;
|
|
20
|
-
}
|
|
21
|
-
super();
|
|
22
|
-
QuarterbackStepsExchanger._instance = this;
|
|
23
|
-
this.applySteps = applySteps;
|
|
24
|
-
this.docId = docId;
|
|
25
|
-
this.projectId = projectId;
|
|
26
|
-
this.currentVersion = startingVersion;
|
|
27
|
-
this.getStepsSince = getStepsSince;
|
|
28
|
-
this.sendSteps = this.sendSteps.bind(this);
|
|
29
|
-
listenToSteps(docId, (version, jsonSteps, clientIDs) => {
|
|
30
|
-
if (!jsonSteps) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
const steps = this.hydrateSteps(jsonSteps);
|
|
34
|
-
if (steps.length) {
|
|
35
|
-
this.newStepsListener(version, steps, clientIDs);
|
|
36
|
-
}
|
|
37
|
-
}, authToken);
|
|
38
|
-
}
|
|
39
|
-
destroy() {
|
|
40
|
-
QuarterbackStepsExchanger._instance = null;
|
|
41
|
-
}
|
|
42
|
-
hydrateSteps(jsonSteps) {
|
|
43
|
-
return jsonSteps.map((s) => Step.fromJSON(schema, s));
|
|
44
|
-
}
|
|
45
|
-
async sendSteps(version, steps, clientID) {
|
|
46
|
-
// Apply and accumulate new steps
|
|
47
|
-
const stepsJSON = [];
|
|
48
|
-
steps.forEach((step) => {
|
|
49
|
-
stepsJSON.push(step.toJSON());
|
|
50
|
-
});
|
|
51
|
-
this.currentVersion = version;
|
|
52
|
-
saveWithThrottle(() => {
|
|
53
|
-
this.applySteps(this.docId, {
|
|
54
|
-
steps: stepsJSON,
|
|
55
|
-
version,
|
|
56
|
-
clientID,
|
|
57
|
-
});
|
|
58
|
-
}, 2000);
|
|
59
|
-
return Promise.resolve();
|
|
60
|
-
}
|
|
61
|
-
onNewSteps(listener) {
|
|
62
|
-
this.newStepsListener = listener;
|
|
63
|
-
}
|
|
64
|
-
async stepsSince(version) {
|
|
65
|
-
// retrieve the steps since the number of version given
|
|
66
|
-
const res = await this.getStepsSince(this.docId, version);
|
|
67
|
-
if (res) {
|
|
68
|
-
return {
|
|
69
|
-
steps: this.hydrateSteps(res.steps),
|
|
70
|
-
clientIDs: res.clientIDs,
|
|
71
|
-
version: res.version,
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
export default QuarterbackStepsExchanger;
|
|
78
|
-
//# sourceMappingURL=QuarterbackStepsExchanger.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"QuarterbackStepsExchanger.js","sourceRoot":"","sources":["../../../../src/quarterback/QuarterbackStepsExchanger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,0B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|
@@ -1,21 +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
|
-
import { ManuscriptNode } from '@manuscripts/transform';
|
|
13
|
-
import { builderFn, StoreDataSourceStrategy } from '../store';
|
|
14
|
-
export default class QuarterbackDataSource implements StoreDataSourceStrategy {
|
|
15
|
-
loadDoc: (manuscriptID: string, projectID: string, doc: ManuscriptNode | undefined) => Promise<{
|
|
16
|
-
doc: ManuscriptNode;
|
|
17
|
-
version: number;
|
|
18
|
-
} | undefined>;
|
|
19
|
-
constructor(loadDoc: QuarterbackDataSource['loadDoc']);
|
|
20
|
-
build: builderFn;
|
|
21
|
-
}
|
|
@@ -1,32 +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) 2022 Atypon Systems LLC. All Rights Reserved.
|
|
11
|
-
*/
|
|
12
|
-
import { CollabProvider } from '@manuscripts/body-editor';
|
|
13
|
-
import { Step } from 'prosemirror-transform';
|
|
14
|
-
import { StepsSinceResponse } from './types';
|
|
15
|
-
declare class QuarterbackStepsExchanger extends CollabProvider {
|
|
16
|
-
private static _instance;
|
|
17
|
-
private applySteps;
|
|
18
|
-
private docId;
|
|
19
|
-
private projectId;
|
|
20
|
-
getStepsSince: (docId: string, version: number) => Promise<StepsSinceResponse | undefined>;
|
|
21
|
-
constructor(docId: string, projectId: string, startingVersion: number, applySteps: QuarterbackStepsExchanger['applySteps'], getStepsSince: QuarterbackStepsExchanger['getStepsSince'], listenToSteps: (docId: string, listener: (version: number, steps: unknown[], clientIDs: number[]) => void, authToken: string) => void, authToken: string);
|
|
22
|
-
destroy(): void;
|
|
23
|
-
hydrateSteps(jsonSteps: unknown[]): Step[];
|
|
24
|
-
sendSteps(version: number, steps: Step[], clientID: string): Promise<void>;
|
|
25
|
-
onNewSteps(listener: CollabProvider['newStepsListener']): void;
|
|
26
|
-
stepsSince(version: number): Promise<{
|
|
27
|
-
steps: Step[];
|
|
28
|
-
clientIDs: number[];
|
|
29
|
-
version: number;
|
|
30
|
-
} | undefined>;
|
|
31
|
-
}
|
|
32
|
-
export default QuarterbackStepsExchanger;
|
|
@@ -1,55 +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) 2022 Atypon Systems LLC. All Rights Reserved.
|
|
11
|
-
*/
|
|
12
|
-
import { JsonValue } from 'type-fest';
|
|
13
|
-
export type ManuscriptSnapshot = {
|
|
14
|
-
id: string;
|
|
15
|
-
name: string;
|
|
16
|
-
snapshot: JsonValue;
|
|
17
|
-
createdAt: Date;
|
|
18
|
-
doc_id: string;
|
|
19
|
-
};
|
|
20
|
-
export type ManuscriptDoc = {
|
|
21
|
-
manuscript_model_id: string;
|
|
22
|
-
user_model_id: string;
|
|
23
|
-
project_model_id: string;
|
|
24
|
-
doc: JsonValue;
|
|
25
|
-
createdAt: Date;
|
|
26
|
-
updatedAt: Date;
|
|
27
|
-
version: number;
|
|
28
|
-
};
|
|
29
|
-
export type SnapshotLabel = Pick<ManuscriptSnapshot, 'id' | 'name' | 'createdAt'>;
|
|
30
|
-
export type ManuscriptDocWithSnapshots = ManuscriptDoc & {
|
|
31
|
-
snapshots: SnapshotLabel[];
|
|
32
|
-
};
|
|
33
|
-
export type UpdateDocumentRequest = {
|
|
34
|
-
doc: Record<string, any>;
|
|
35
|
-
};
|
|
36
|
-
export interface CreateDocRequest {
|
|
37
|
-
manuscript_model_id: string;
|
|
38
|
-
project_model_id: string;
|
|
39
|
-
doc: Record<string, any>;
|
|
40
|
-
}
|
|
41
|
-
export type StepsPayload = {
|
|
42
|
-
steps: unknown[];
|
|
43
|
-
version: number;
|
|
44
|
-
clientID: number | string;
|
|
45
|
-
};
|
|
46
|
-
export type AppliedStepsResponse = {
|
|
47
|
-
lastVersion?: number;
|
|
48
|
-
steps?: number;
|
|
49
|
-
error?: string;
|
|
50
|
-
};
|
|
51
|
-
export type StepsSinceResponse = {
|
|
52
|
-
steps: unknown[];
|
|
53
|
-
version: number;
|
|
54
|
-
clientIDs: number[];
|
|
55
|
-
};
|