@manuscripts/track-changes-plugin 0.0.4 → 0.3.0
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/README.md +20 -45
- package/dist/actions.d.ts +8 -1
- package/dist/index.cjs +1591 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.es.js +25 -13
- package/dist/index.js +173 -144
- package/dist/plugin.d.ts +2 -2
- package/dist/track/deleteNode.d.ts +1 -1
- package/dist/track/mergeNode.d.ts +1 -1
- package/dist/track/node-utils.d.ts +4 -11
- package/dist/track/steps/deleteAndMergeSplitNodes.d.ts +1 -1
- package/dist/track/steps/setFragmentAsInserted.d.ts +1 -1
- package/dist/track/steps/track-utils.d.ts +0 -1
- package/dist/track/trackTransaction.d.ts +2 -2
- package/dist/types/change.d.ts +4 -1
- package/package.json +17 -21
package/dist/plugin.d.ts
CHANGED
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { Plugin, PluginKey } from 'prosemirror-state';
|
|
17
17
|
import { TrackChangesOptions, TrackChangesState } from './types/track';
|
|
18
|
-
export declare const trackChangesPluginKey: PluginKey<TrackChangesState
|
|
18
|
+
export declare const trackChangesPluginKey: PluginKey<TrackChangesState>;
|
|
19
19
|
/**
|
|
20
20
|
* The ProseMirror plugin needed to enable track-changes.
|
|
21
21
|
*
|
|
22
22
|
* Accepts an empty options object as an argument but note that this uses 'anonymous:Anonymous' as the default userID.
|
|
23
23
|
* @param opts
|
|
24
24
|
*/
|
|
25
|
-
export declare const trackChangesPlugin: (opts?: TrackChangesOptions) => Plugin<TrackChangesState
|
|
25
|
+
export declare const trackChangesPlugin: (opts?: TrackChangesOptions) => Plugin<TrackChangesState>;
|
|
@@ -24,4 +24,4 @@ import { Transaction } from 'prosemirror-state';
|
|
|
24
24
|
* @param tr
|
|
25
25
|
* @returns
|
|
26
26
|
*/
|
|
27
|
-
export declare function deleteNode(node: PMNode, pos: number, tr: Transaction): Transaction
|
|
27
|
+
export declare function deleteNode(node: PMNode, pos: number, tr: Transaction): Transaction;
|
|
@@ -22,4 +22,4 @@ import { Transaction } from 'prosemirror-state';
|
|
|
22
22
|
* @param tr
|
|
23
23
|
* @returns
|
|
24
24
|
*/
|
|
25
|
-
export declare function mergeNode(node: PMNode, pos: number, tr: Transaction): Transaction
|
|
25
|
+
export declare function mergeNode(node: PMNode, pos: number, tr: Transaction): Transaction | undefined;
|
|
@@ -14,21 +14,14 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { Node as PMNode, Schema } from 'prosemirror-model';
|
|
17
|
-
import { Transaction } from 'prosemirror-state';
|
|
18
17
|
import { CHANGE_OPERATION, TrackedAttrs } from '../types/change';
|
|
19
18
|
export declare function addTrackIdIfDoesntExist(attrs: Partial<TrackedAttrs>): Partial<TrackedAttrs>;
|
|
20
|
-
|
|
21
|
-
* Not in use, maybe for ReplaceAroundSteps but we'll see
|
|
22
|
-
* @param pos
|
|
23
|
-
* @param tr
|
|
24
|
-
*/
|
|
25
|
-
export declare function liftNode(pos: number, tr: Transaction): Transaction<any> | undefined;
|
|
26
|
-
export declare function getInlineNodeTrackedMarkData(node: PMNode | undefined | null, schema: Schema): {
|
|
19
|
+
export declare function getInlineNodeTrackedMarkData(node: PMNode | undefined | null, schema: Schema): (Omit<Partial<TrackedAttrs>, "operation"> & {
|
|
27
20
|
operation: CHANGE_OPERATION;
|
|
28
|
-
} | undefined;
|
|
21
|
+
}) | undefined;
|
|
29
22
|
export declare function getNodeTrackedData(node: PMNode | undefined | null, schema: Schema): Partial<TrackedAttrs> | undefined;
|
|
30
23
|
export declare function equalMarks(n1: PMNode, n2: PMNode): boolean;
|
|
31
24
|
export declare function shouldMergeTrackedAttributes(left?: Partial<TrackedAttrs>, right?: Partial<TrackedAttrs>): boolean;
|
|
32
|
-
export declare function getMergeableMarkTrackedAttrs(node: PMNode | undefined | null, attrs: Partial<TrackedAttrs>, schema: Schema): {
|
|
25
|
+
export declare function getMergeableMarkTrackedAttrs(node: PMNode | undefined | null, attrs: Partial<TrackedAttrs>, schema: Schema): (Omit<Partial<TrackedAttrs>, "operation"> & {
|
|
33
26
|
operation: CHANGE_OPERATION;
|
|
34
|
-
} | null;
|
|
27
|
+
}) | null;
|
|
@@ -49,5 +49,5 @@ export declare function deleteAndMergeSplitNodes(from: number, to: number, gap:
|
|
|
49
49
|
} | undefined, startDoc: PMNode, newTr: Transaction, schema: Schema, trackAttrs: NewEmptyAttrs, insertSlice: ExposedSlice): {
|
|
50
50
|
deleteMap: Mapping;
|
|
51
51
|
mergedInsertPos: undefined;
|
|
52
|
-
newSliceContent: Fragment
|
|
52
|
+
newSliceContent: Fragment;
|
|
53
53
|
};
|
|
@@ -15,4 +15,4 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { Fragment, Schema } from 'prosemirror-model';
|
|
17
17
|
import { NewInsertAttrs } from '../../types/track';
|
|
18
|
-
export declare function setFragmentAsInserted(inserted: Fragment, insertAttrs: NewInsertAttrs, schema: Schema): Fragment
|
|
18
|
+
export declare function setFragmentAsInserted(inserted: Fragment, insertAttrs: NewInsertAttrs, schema: Schema): Fragment;
|
|
@@ -14,6 +14,5 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { NewDeleteAttrs, NewEmptyAttrs, NewInsertAttrs } from '../../types/track';
|
|
17
|
-
export declare function createNewEmptyAttrs(userID: string, createdAt: number): NewEmptyAttrs;
|
|
18
17
|
export declare function createNewInsertAttrs(attrs: NewEmptyAttrs): NewInsertAttrs;
|
|
19
18
|
export declare function createNewDeleteAttrs(attrs: NewEmptyAttrs): NewDeleteAttrs;
|
|
@@ -11,7 +11,7 @@ import type { EditorState, Transaction } from 'prosemirror-state';
|
|
|
11
11
|
* @param tr Original transaction
|
|
12
12
|
* @param oldState State before transaction
|
|
13
13
|
* @param newTr Transaction created from the new editor state
|
|
14
|
-
* @param
|
|
14
|
+
* @param authorID User id
|
|
15
15
|
* @returns newTr that inverts the initial tr and applies track attributes/marks
|
|
16
16
|
*/
|
|
17
|
-
export declare function trackTransaction(tr: Transaction, oldState: EditorState, newTr: Transaction,
|
|
17
|
+
export declare function trackTransaction(tr: Transaction, oldState: EditorState, newTr: Transaction, authorID: string): Transaction;
|
package/dist/types/change.d.ts
CHANGED
|
@@ -29,10 +29,12 @@ export declare enum CHANGE_STATUS {
|
|
|
29
29
|
}
|
|
30
30
|
export interface TrackedAttrs {
|
|
31
31
|
id: string;
|
|
32
|
-
|
|
32
|
+
authorID: string;
|
|
33
|
+
reviewedByID: string | null;
|
|
33
34
|
operation: CHANGE_OPERATION;
|
|
34
35
|
status: CHANGE_STATUS;
|
|
35
36
|
createdAt: number;
|
|
37
|
+
updatedAt: number;
|
|
36
38
|
}
|
|
37
39
|
export declare type Change = {
|
|
38
40
|
id: string;
|
|
@@ -42,6 +44,7 @@ export declare type Change = {
|
|
|
42
44
|
};
|
|
43
45
|
export declare type TextChange = Change & {
|
|
44
46
|
type: 'text-change';
|
|
47
|
+
text: string;
|
|
45
48
|
};
|
|
46
49
|
export declare type NodeChange = Change & {
|
|
47
50
|
type: 'node-change';
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manuscripts/track-changes-plugin",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"author": "Atypon Systems LLC",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/Atypon-OpenSource/manuscripts-quarterback/tree/main/quarterback-packages/track-changes-plugin",
|
|
7
|
-
"main": "dist/index.
|
|
8
|
-
"module": "dist/index.
|
|
7
|
+
"main": "dist/index.cjs",
|
|
8
|
+
"module": "dist/index.js",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"types": "dist/index.d.ts",
|
|
11
11
|
"exports": {
|
|
12
12
|
"./package.json": "./package.json",
|
|
13
13
|
"./src/styles.css": "./src/styles.css",
|
|
14
|
-
".": "./dist/index.
|
|
14
|
+
".": "./dist/index.js"
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
17
|
"dist",
|
|
@@ -21,30 +21,25 @@
|
|
|
21
21
|
"access": "public"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
+
"@manuscripts/manuscript-transform": "^0.49.4",
|
|
24
25
|
"@rollup/plugin-commonjs": "^22.0.0",
|
|
25
26
|
"@types/debug": "^4.1.7",
|
|
26
27
|
"@types/jest": "27.5.1",
|
|
27
28
|
"@types/node": "^17.0.35",
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"@types/prosemirror-schema-list": "^1.0.3",
|
|
31
|
-
"@types/prosemirror-state": "^1.3.0",
|
|
32
|
-
"@types/prosemirror-transform": "^1.4.1",
|
|
33
|
-
"@types/prosemirror-view": "^1.23.3",
|
|
34
|
-
"jest": "28.1.0",
|
|
35
|
-
"jest-environment-jsdom": "28.1.0",
|
|
29
|
+
"jest": "27.5.1",
|
|
30
|
+
"jest-environment-jsdom": "27.5.1",
|
|
36
31
|
"jsdom": "^19.0.0",
|
|
37
|
-
"prosemirror-commands": "^1.
|
|
38
|
-
"prosemirror-example-setup": "^1.1
|
|
39
|
-
"prosemirror-keymap": "^1.
|
|
40
|
-
"prosemirror-model": "^1.
|
|
41
|
-
"prosemirror-schema-list": "^1.
|
|
42
|
-
"prosemirror-state": "^1.
|
|
43
|
-
"prosemirror-transform": "^1.
|
|
44
|
-
"prosemirror-view": "^1.
|
|
32
|
+
"prosemirror-commands": "^1.3.0",
|
|
33
|
+
"prosemirror-example-setup": "^1.2.1",
|
|
34
|
+
"prosemirror-keymap": "^1.2.0",
|
|
35
|
+
"prosemirror-model": "^1.18.1",
|
|
36
|
+
"prosemirror-schema-list": "^1.2.0",
|
|
37
|
+
"prosemirror-state": "^1.4.1",
|
|
38
|
+
"prosemirror-transform": "^1.6.0",
|
|
39
|
+
"prosemirror-view": "^1.26.2",
|
|
45
40
|
"rollup": "^2.74.0",
|
|
46
41
|
"rollup-plugin-typescript2": "^0.31.2",
|
|
47
|
-
"ts-jest": "
|
|
42
|
+
"ts-jest": "27.1.4",
|
|
48
43
|
"tslib": "^2.4.0",
|
|
49
44
|
"typescript": "^4.6.4"
|
|
50
45
|
},
|
|
@@ -62,6 +57,7 @@
|
|
|
62
57
|
"watch": "rollup -cw",
|
|
63
58
|
"test": "jest --runInBand",
|
|
64
59
|
"format": "prettier --write \"*.+(js|json|yml|yaml|ts|md|graphql|mdx)\" src/ test/",
|
|
60
|
+
"typecheck": "tsc --project tsconfig.test.json --noEmit",
|
|
65
61
|
"lint": "eslint --cache --ext .js,.ts, ./src ./test",
|
|
66
62
|
"lint:fix": "eslint --fix --ext .js,.ts, ./src ./test"
|
|
67
63
|
}
|