@atlaskit/editor-plugin-show-diff 0.1.4 → 0.1.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/CHANGELOG.md +15 -0
- package/afm-cc/tsconfig.json +2 -2
- package/dist/cjs/pm-plugins/main.js +30 -35
- package/dist/es2019/pm-plugins/main.js +30 -35
- package/dist/esm/pm-plugins/main.js +30 -35
- package/dist/types/pm-plugins/NodeViewSerializer.d.ts +2 -2
- package/dist/types/pm-plugins/decorations.d.ts +2 -2
- package/dist/types/pm-plugins/main.d.ts +2 -2
- package/dist/types/showDiffPluginType.d.ts +4 -4
- package/dist/types-ts4.5/pm-plugins/NodeViewSerializer.d.ts +2 -2
- package/dist/types-ts4.5/pm-plugins/decorations.d.ts +2 -2
- package/dist/types-ts4.5/pm-plugins/main.d.ts +2 -2
- package/dist/types-ts4.5/showDiffPluginType.d.ts +4 -4
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-show-diff
|
|
2
2
|
|
|
3
|
+
## 0.1.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`3d9a6a0aae8c5`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3d9a6a0aae8c5) -
|
|
8
|
+
Fix show diff not loading inline node diffs on load
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 0.1.5
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`265c1bf0cefa4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/265c1bf0cefa4) -
|
|
16
|
+
Sorted type and interface props to improve Atlaskit docs
|
|
17
|
+
|
|
3
18
|
## 0.1.4
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/afm-cc/tsconfig.json
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"extends": "../../../../tsconfig.entry-points.confluence.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"target": "es5",
|
|
5
|
-
"composite": true,
|
|
6
5
|
"outDir": "../../../../../confluence/tsDist/@atlaskit__editor-plugin-show-diff",
|
|
7
|
-
"rootDir": "../"
|
|
6
|
+
"rootDir": "../",
|
|
7
|
+
"composite": true
|
|
8
8
|
},
|
|
9
9
|
"include": [
|
|
10
10
|
"../src/**/*.ts",
|
|
@@ -82,56 +82,36 @@ var createPlugin = exports.createPlugin = function createPlugin(config) {
|
|
|
82
82
|
key: showDiffPluginKey,
|
|
83
83
|
state: {
|
|
84
84
|
init: function init(_, state) {
|
|
85
|
-
|
|
86
|
-
var schema = state.schema;
|
|
87
|
-
var isDisplayingChanges = ((_config$steps = config === null || config === void 0 ? void 0 : config.steps) !== null && _config$steps !== void 0 ? _config$steps : []).length > 0;
|
|
88
|
-
var steps = ((_config$steps2 = config === null || config === void 0 ? void 0 : config.steps) !== null && _config$steps2 !== void 0 ? _config$steps2 : []).map(function (step) {
|
|
89
|
-
return _transform.Step.fromJSON(schema, step);
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
93
|
-
var nodeViews = ((_editorView = editorView) === null || _editorView === void 0 ? void 0 : _editorView.nodeViews) || {};
|
|
85
|
+
// We do initial setup after we setup the editor view
|
|
94
86
|
return {
|
|
95
|
-
steps:
|
|
96
|
-
originalDoc:
|
|
97
|
-
decorations:
|
|
98
|
-
|
|
99
|
-
pluginState: {
|
|
100
|
-
steps: steps,
|
|
101
|
-
originalDoc: config !== null && config !== void 0 && config.originalDoc ? (0, _processRawValue.processRawValue)(state.schema, config.originalDoc) : undefined,
|
|
102
|
-
isDisplayingChanges: isDisplayingChanges
|
|
103
|
-
},
|
|
104
|
-
editorView: editorView,
|
|
105
|
-
nodeViews: nodeViews
|
|
106
|
-
}),
|
|
107
|
-
isDisplayingChanges: isDisplayingChanges
|
|
87
|
+
steps: [],
|
|
88
|
+
originalDoc: undefined,
|
|
89
|
+
decorations: _view.DecorationSet.empty,
|
|
90
|
+
isDisplayingChanges: false
|
|
108
91
|
};
|
|
109
92
|
},
|
|
110
93
|
apply: function apply(tr, currentPluginState, oldState, newState) {
|
|
111
|
-
var
|
|
94
|
+
var _editorView;
|
|
112
95
|
var meta = tr.getMeta(showDiffPluginKey);
|
|
113
96
|
var newPluginState = currentPluginState;
|
|
114
97
|
|
|
115
98
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
116
|
-
var nodeViews = ((
|
|
99
|
+
var nodeViews = ((_editorView = editorView) === null || _editorView === void 0 ? void 0 : _editorView.nodeViews) || {};
|
|
117
100
|
if (meta) {
|
|
118
101
|
if ((meta === null || meta === void 0 ? void 0 : meta.action) === 'SHOW_DIFF') {
|
|
119
|
-
|
|
102
|
+
// Update the plugin state with the new metadata
|
|
103
|
+
newPluginState = _objectSpread(_objectSpread(_objectSpread({}, currentPluginState), meta), {}, {
|
|
104
|
+
isDisplayingChanges: true
|
|
105
|
+
});
|
|
120
106
|
// Calculate and store decorations in state
|
|
121
107
|
var decorations = calculateDecorations({
|
|
122
108
|
state: newState,
|
|
123
|
-
pluginState:
|
|
124
|
-
steps: (_meta$steps = meta.steps) !== null && _meta$steps !== void 0 ? _meta$steps : currentPluginState.steps,
|
|
125
|
-
originalDoc: (_meta$originalDoc = meta.originalDoc) !== null && _meta$originalDoc !== void 0 ? _meta$originalDoc : currentPluginState.originalDoc,
|
|
126
|
-
isDisplayingChanges: true
|
|
127
|
-
},
|
|
109
|
+
pluginState: newPluginState,
|
|
128
110
|
editorView: editorView,
|
|
129
111
|
nodeViews: nodeViews
|
|
130
112
|
});
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
isDisplayingChanges: true
|
|
134
|
-
});
|
|
113
|
+
// Update the decorations
|
|
114
|
+
newPluginState.decorations = decorations;
|
|
135
115
|
} else if ((meta === null || meta === void 0 ? void 0 : meta.action) === 'HIDE_DIFF') {
|
|
136
116
|
newPluginState = _objectSpread(_objectSpread(_objectSpread({}, currentPluginState), meta), {}, {
|
|
137
117
|
decorations: _view.DecorationSet.empty,
|
|
@@ -148,7 +128,22 @@ var createPlugin = exports.createPlugin = function createPlugin(config) {
|
|
|
148
128
|
},
|
|
149
129
|
view: function view(editorView) {
|
|
150
130
|
setEditorView(editorView);
|
|
151
|
-
|
|
131
|
+
var isFirst = true;
|
|
132
|
+
return {
|
|
133
|
+
update: function update(view) {
|
|
134
|
+
// If we're using configuration to show diffs we initialise here once we setup the editor view
|
|
135
|
+
if (config !== null && config !== void 0 && config.originalDoc && config !== null && config !== void 0 && config.steps && config.steps.length > 0 && isFirst) {
|
|
136
|
+
isFirst = false;
|
|
137
|
+
view.dispatch(view.state.tr.setMeta(showDiffPluginKey, {
|
|
138
|
+
action: 'SHOW_DIFF',
|
|
139
|
+
steps: config.steps.map(function (step) {
|
|
140
|
+
return _transform.Step.fromJSON(view.state.schema, step);
|
|
141
|
+
}),
|
|
142
|
+
originalDoc: (0, _processRawValue.processRawValue)(view.state.schema, config.originalDoc)
|
|
143
|
+
}));
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
};
|
|
152
147
|
},
|
|
153
148
|
props: {
|
|
154
149
|
decorations: function decorations(state) {
|
|
@@ -66,56 +66,38 @@ export const createPlugin = config => {
|
|
|
66
66
|
key: showDiffPluginKey,
|
|
67
67
|
state: {
|
|
68
68
|
init(_, state) {
|
|
69
|
-
|
|
70
|
-
const schema = state.schema;
|
|
71
|
-
const isDisplayingChanges = ((_config$steps = config === null || config === void 0 ? void 0 : config.steps) !== null && _config$steps !== void 0 ? _config$steps : []).length > 0;
|
|
72
|
-
const steps = ((_config$steps2 = config === null || config === void 0 ? void 0 : config.steps) !== null && _config$steps2 !== void 0 ? _config$steps2 : []).map(step => ProseMirrorStep.fromJSON(schema, step));
|
|
73
|
-
|
|
74
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
75
|
-
const nodeViews = ((_editorView = editorView) === null || _editorView === void 0 ? void 0 : _editorView.nodeViews) || {};
|
|
69
|
+
// We do initial setup after we setup the editor view
|
|
76
70
|
return {
|
|
77
|
-
steps,
|
|
78
|
-
originalDoc:
|
|
79
|
-
decorations:
|
|
80
|
-
|
|
81
|
-
pluginState: {
|
|
82
|
-
steps,
|
|
83
|
-
originalDoc: config !== null && config !== void 0 && config.originalDoc ? processRawValue(state.schema, config.originalDoc) : undefined,
|
|
84
|
-
isDisplayingChanges
|
|
85
|
-
},
|
|
86
|
-
editorView,
|
|
87
|
-
nodeViews
|
|
88
|
-
}),
|
|
89
|
-
isDisplayingChanges
|
|
71
|
+
steps: [],
|
|
72
|
+
originalDoc: undefined,
|
|
73
|
+
decorations: DecorationSet.empty,
|
|
74
|
+
isDisplayingChanges: false
|
|
90
75
|
};
|
|
91
76
|
},
|
|
92
77
|
apply: (tr, currentPluginState, oldState, newState) => {
|
|
93
|
-
var
|
|
78
|
+
var _editorView;
|
|
94
79
|
const meta = tr.getMeta(showDiffPluginKey);
|
|
95
80
|
let newPluginState = currentPluginState;
|
|
96
81
|
|
|
97
82
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
98
|
-
const nodeViews = ((
|
|
83
|
+
const nodeViews = ((_editorView = editorView) === null || _editorView === void 0 ? void 0 : _editorView.nodeViews) || {};
|
|
99
84
|
if (meta) {
|
|
100
85
|
if ((meta === null || meta === void 0 ? void 0 : meta.action) === 'SHOW_DIFF') {
|
|
101
|
-
|
|
86
|
+
// Update the plugin state with the new metadata
|
|
87
|
+
newPluginState = {
|
|
88
|
+
...currentPluginState,
|
|
89
|
+
...meta,
|
|
90
|
+
isDisplayingChanges: true
|
|
91
|
+
};
|
|
102
92
|
// Calculate and store decorations in state
|
|
103
93
|
const decorations = calculateDecorations({
|
|
104
94
|
state: newState,
|
|
105
|
-
pluginState:
|
|
106
|
-
steps: (_meta$steps = meta.steps) !== null && _meta$steps !== void 0 ? _meta$steps : currentPluginState.steps,
|
|
107
|
-
originalDoc: (_meta$originalDoc = meta.originalDoc) !== null && _meta$originalDoc !== void 0 ? _meta$originalDoc : currentPluginState.originalDoc,
|
|
108
|
-
isDisplayingChanges: true
|
|
109
|
-
},
|
|
95
|
+
pluginState: newPluginState,
|
|
110
96
|
editorView,
|
|
111
97
|
nodeViews: nodeViews
|
|
112
98
|
});
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
...meta,
|
|
116
|
-
decorations,
|
|
117
|
-
isDisplayingChanges: true
|
|
118
|
-
};
|
|
99
|
+
// Update the decorations
|
|
100
|
+
newPluginState.decorations = decorations;
|
|
119
101
|
} else if ((meta === null || meta === void 0 ? void 0 : meta.action) === 'HIDE_DIFF') {
|
|
120
102
|
newPluginState = {
|
|
121
103
|
...currentPluginState,
|
|
@@ -138,7 +120,20 @@ export const createPlugin = config => {
|
|
|
138
120
|
},
|
|
139
121
|
view(editorView) {
|
|
140
122
|
setEditorView(editorView);
|
|
141
|
-
|
|
123
|
+
let isFirst = true;
|
|
124
|
+
return {
|
|
125
|
+
update(view) {
|
|
126
|
+
// If we're using configuration to show diffs we initialise here once we setup the editor view
|
|
127
|
+
if (config !== null && config !== void 0 && config.originalDoc && config !== null && config !== void 0 && config.steps && config.steps.length > 0 && isFirst) {
|
|
128
|
+
isFirst = false;
|
|
129
|
+
view.dispatch(view.state.tr.setMeta(showDiffPluginKey, {
|
|
130
|
+
action: 'SHOW_DIFF',
|
|
131
|
+
steps: config.steps.map(step => ProseMirrorStep.fromJSON(view.state.schema, step)),
|
|
132
|
+
originalDoc: processRawValue(view.state.schema, config.originalDoc)
|
|
133
|
+
}));
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
};
|
|
142
137
|
},
|
|
143
138
|
props: {
|
|
144
139
|
decorations: state => {
|
|
@@ -76,56 +76,36 @@ export var createPlugin = function createPlugin(config) {
|
|
|
76
76
|
key: showDiffPluginKey,
|
|
77
77
|
state: {
|
|
78
78
|
init: function init(_, state) {
|
|
79
|
-
|
|
80
|
-
var schema = state.schema;
|
|
81
|
-
var isDisplayingChanges = ((_config$steps = config === null || config === void 0 ? void 0 : config.steps) !== null && _config$steps !== void 0 ? _config$steps : []).length > 0;
|
|
82
|
-
var steps = ((_config$steps2 = config === null || config === void 0 ? void 0 : config.steps) !== null && _config$steps2 !== void 0 ? _config$steps2 : []).map(function (step) {
|
|
83
|
-
return ProseMirrorStep.fromJSON(schema, step);
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
87
|
-
var nodeViews = ((_editorView = editorView) === null || _editorView === void 0 ? void 0 : _editorView.nodeViews) || {};
|
|
79
|
+
// We do initial setup after we setup the editor view
|
|
88
80
|
return {
|
|
89
|
-
steps:
|
|
90
|
-
originalDoc:
|
|
91
|
-
decorations:
|
|
92
|
-
|
|
93
|
-
pluginState: {
|
|
94
|
-
steps: steps,
|
|
95
|
-
originalDoc: config !== null && config !== void 0 && config.originalDoc ? processRawValue(state.schema, config.originalDoc) : undefined,
|
|
96
|
-
isDisplayingChanges: isDisplayingChanges
|
|
97
|
-
},
|
|
98
|
-
editorView: editorView,
|
|
99
|
-
nodeViews: nodeViews
|
|
100
|
-
}),
|
|
101
|
-
isDisplayingChanges: isDisplayingChanges
|
|
81
|
+
steps: [],
|
|
82
|
+
originalDoc: undefined,
|
|
83
|
+
decorations: DecorationSet.empty,
|
|
84
|
+
isDisplayingChanges: false
|
|
102
85
|
};
|
|
103
86
|
},
|
|
104
87
|
apply: function apply(tr, currentPluginState, oldState, newState) {
|
|
105
|
-
var
|
|
88
|
+
var _editorView;
|
|
106
89
|
var meta = tr.getMeta(showDiffPluginKey);
|
|
107
90
|
var newPluginState = currentPluginState;
|
|
108
91
|
|
|
109
92
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
110
|
-
var nodeViews = ((
|
|
93
|
+
var nodeViews = ((_editorView = editorView) === null || _editorView === void 0 ? void 0 : _editorView.nodeViews) || {};
|
|
111
94
|
if (meta) {
|
|
112
95
|
if ((meta === null || meta === void 0 ? void 0 : meta.action) === 'SHOW_DIFF') {
|
|
113
|
-
|
|
96
|
+
// Update the plugin state with the new metadata
|
|
97
|
+
newPluginState = _objectSpread(_objectSpread(_objectSpread({}, currentPluginState), meta), {}, {
|
|
98
|
+
isDisplayingChanges: true
|
|
99
|
+
});
|
|
114
100
|
// Calculate and store decorations in state
|
|
115
101
|
var decorations = calculateDecorations({
|
|
116
102
|
state: newState,
|
|
117
|
-
pluginState:
|
|
118
|
-
steps: (_meta$steps = meta.steps) !== null && _meta$steps !== void 0 ? _meta$steps : currentPluginState.steps,
|
|
119
|
-
originalDoc: (_meta$originalDoc = meta.originalDoc) !== null && _meta$originalDoc !== void 0 ? _meta$originalDoc : currentPluginState.originalDoc,
|
|
120
|
-
isDisplayingChanges: true
|
|
121
|
-
},
|
|
103
|
+
pluginState: newPluginState,
|
|
122
104
|
editorView: editorView,
|
|
123
105
|
nodeViews: nodeViews
|
|
124
106
|
});
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
isDisplayingChanges: true
|
|
128
|
-
});
|
|
107
|
+
// Update the decorations
|
|
108
|
+
newPluginState.decorations = decorations;
|
|
129
109
|
} else if ((meta === null || meta === void 0 ? void 0 : meta.action) === 'HIDE_DIFF') {
|
|
130
110
|
newPluginState = _objectSpread(_objectSpread(_objectSpread({}, currentPluginState), meta), {}, {
|
|
131
111
|
decorations: DecorationSet.empty,
|
|
@@ -142,7 +122,22 @@ export var createPlugin = function createPlugin(config) {
|
|
|
142
122
|
},
|
|
143
123
|
view: function view(editorView) {
|
|
144
124
|
setEditorView(editorView);
|
|
145
|
-
|
|
125
|
+
var isFirst = true;
|
|
126
|
+
return {
|
|
127
|
+
update: function update(view) {
|
|
128
|
+
// If we're using configuration to show diffs we initialise here once we setup the editor view
|
|
129
|
+
if (config !== null && config !== void 0 && config.originalDoc && config !== null && config !== void 0 && config.steps && config.steps.length > 0 && isFirst) {
|
|
130
|
+
isFirst = false;
|
|
131
|
+
view.dispatch(view.state.tr.setMeta(showDiffPluginKey, {
|
|
132
|
+
action: 'SHOW_DIFF',
|
|
133
|
+
steps: config.steps.map(function (step) {
|
|
134
|
+
return ProseMirrorStep.fromJSON(view.state.schema, step);
|
|
135
|
+
}),
|
|
136
|
+
originalDoc: processRawValue(view.state.schema, config.originalDoc)
|
|
137
|
+
}));
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
};
|
|
146
141
|
},
|
|
147
142
|
props: {
|
|
148
143
|
decorations: function decorations(state) {
|
|
@@ -39,10 +39,10 @@ export declare class NodeViewSerializer {
|
|
|
39
39
|
private nodeViews;
|
|
40
40
|
private nodeViewBlocklist;
|
|
41
41
|
constructor(params: {
|
|
42
|
-
|
|
42
|
+
blocklist?: string[];
|
|
43
43
|
editorView?: EditorView;
|
|
44
44
|
nodeViews?: Record<string, NodeViewConstructor>;
|
|
45
|
-
|
|
45
|
+
schema: Schema;
|
|
46
46
|
});
|
|
47
47
|
/**
|
|
48
48
|
* Attempts to create a node view for the given node.
|
|
@@ -17,9 +17,9 @@ export declare const createInlineChangedDecoration: (change: {
|
|
|
17
17
|
interface DeletedContentDecorationProps {
|
|
18
18
|
change: Change;
|
|
19
19
|
doc: PMNode;
|
|
20
|
-
tr: Transaction;
|
|
21
|
-
nodeViews: Record<string, NodeViewConstructor>;
|
|
22
20
|
editorView?: EditorView;
|
|
21
|
+
nodeViews: Record<string, NodeViewConstructor>;
|
|
22
|
+
tr: Transaction;
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
25
|
* Creates a widget to represent the deleted content in the editor
|
|
@@ -6,10 +6,10 @@ import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
|
6
6
|
import { type DiffParams } from '../showDiffPluginType';
|
|
7
7
|
export declare const showDiffPluginKey: PluginKey<ShowDiffPluginState>;
|
|
8
8
|
type ShowDiffPluginState = {
|
|
9
|
-
steps: ProseMirrorStep[];
|
|
10
|
-
originalDoc: PMNode | undefined;
|
|
11
9
|
decorations: DecorationSet;
|
|
12
10
|
isDisplayingChanges: boolean;
|
|
11
|
+
originalDoc: PMNode | undefined;
|
|
12
|
+
steps: ProseMirrorStep[];
|
|
13
13
|
};
|
|
14
14
|
export declare const createPlugin: (config: DiffParams | undefined) => SafePlugin<ShowDiffPluginState>;
|
|
15
15
|
export {};
|
|
@@ -4,26 +4,26 @@ import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
|
|
|
4
4
|
import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
5
5
|
import type { Step } from '@atlaskit/editor-prosemirror/transform';
|
|
6
6
|
export type DiffParams = {
|
|
7
|
+
originalDoc: JSONDocNode;
|
|
7
8
|
/**
|
|
8
9
|
* Prosemirror steps. This is used to calculate and show the diff in the editor
|
|
9
10
|
*/
|
|
10
11
|
steps: StepJson[];
|
|
11
|
-
originalDoc: JSONDocNode;
|
|
12
12
|
};
|
|
13
13
|
export type PMDiffParams = {
|
|
14
|
+
originalDoc: Node;
|
|
14
15
|
/**
|
|
15
16
|
* Prosemirror steps. This is used to calculate and show the diff in the editor
|
|
16
17
|
*/
|
|
17
18
|
steps: Step[];
|
|
18
|
-
originalDoc: Node;
|
|
19
19
|
};
|
|
20
20
|
export type ACTION = 'SHOW_DIFF' | 'HIDE_DIFF';
|
|
21
21
|
export type ShowDiffPlugin = NextEditorPlugin<'showDiff', {
|
|
22
|
-
pluginConfiguration: DiffParams | undefined;
|
|
23
22
|
commands: {
|
|
24
|
-
showDiff: (config: PMDiffParams) => EditorCommand;
|
|
25
23
|
hideDiff: EditorCommand;
|
|
24
|
+
showDiff: (config: PMDiffParams) => EditorCommand;
|
|
26
25
|
};
|
|
26
|
+
pluginConfiguration: DiffParams | undefined;
|
|
27
27
|
sharedState: {
|
|
28
28
|
/**
|
|
29
29
|
* Whether the show diff feature is currently displaying changes.
|
|
@@ -39,10 +39,10 @@ export declare class NodeViewSerializer {
|
|
|
39
39
|
private nodeViews;
|
|
40
40
|
private nodeViewBlocklist;
|
|
41
41
|
constructor(params: {
|
|
42
|
-
|
|
42
|
+
blocklist?: string[];
|
|
43
43
|
editorView?: EditorView;
|
|
44
44
|
nodeViews?: Record<string, NodeViewConstructor>;
|
|
45
|
-
|
|
45
|
+
schema: Schema;
|
|
46
46
|
});
|
|
47
47
|
/**
|
|
48
48
|
* Attempts to create a node view for the given node.
|
|
@@ -17,9 +17,9 @@ export declare const createInlineChangedDecoration: (change: {
|
|
|
17
17
|
interface DeletedContentDecorationProps {
|
|
18
18
|
change: Change;
|
|
19
19
|
doc: PMNode;
|
|
20
|
-
tr: Transaction;
|
|
21
|
-
nodeViews: Record<string, NodeViewConstructor>;
|
|
22
20
|
editorView?: EditorView;
|
|
21
|
+
nodeViews: Record<string, NodeViewConstructor>;
|
|
22
|
+
tr: Transaction;
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
25
|
* Creates a widget to represent the deleted content in the editor
|
|
@@ -6,10 +6,10 @@ import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
|
6
6
|
import { type DiffParams } from '../showDiffPluginType';
|
|
7
7
|
export declare const showDiffPluginKey: PluginKey<ShowDiffPluginState>;
|
|
8
8
|
type ShowDiffPluginState = {
|
|
9
|
-
steps: ProseMirrorStep[];
|
|
10
|
-
originalDoc: PMNode | undefined;
|
|
11
9
|
decorations: DecorationSet;
|
|
12
10
|
isDisplayingChanges: boolean;
|
|
11
|
+
originalDoc: PMNode | undefined;
|
|
12
|
+
steps: ProseMirrorStep[];
|
|
13
13
|
};
|
|
14
14
|
export declare const createPlugin: (config: DiffParams | undefined) => SafePlugin<ShowDiffPluginState>;
|
|
15
15
|
export {};
|
|
@@ -4,26 +4,26 @@ import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
|
|
|
4
4
|
import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
5
5
|
import type { Step } from '@atlaskit/editor-prosemirror/transform';
|
|
6
6
|
export type DiffParams = {
|
|
7
|
+
originalDoc: JSONDocNode;
|
|
7
8
|
/**
|
|
8
9
|
* Prosemirror steps. This is used to calculate and show the diff in the editor
|
|
9
10
|
*/
|
|
10
11
|
steps: StepJson[];
|
|
11
|
-
originalDoc: JSONDocNode;
|
|
12
12
|
};
|
|
13
13
|
export type PMDiffParams = {
|
|
14
|
+
originalDoc: Node;
|
|
14
15
|
/**
|
|
15
16
|
* Prosemirror steps. This is used to calculate and show the diff in the editor
|
|
16
17
|
*/
|
|
17
18
|
steps: Step[];
|
|
18
|
-
originalDoc: Node;
|
|
19
19
|
};
|
|
20
20
|
export type ACTION = 'SHOW_DIFF' | 'HIDE_DIFF';
|
|
21
21
|
export type ShowDiffPlugin = NextEditorPlugin<'showDiff', {
|
|
22
|
-
pluginConfiguration: DiffParams | undefined;
|
|
23
22
|
commands: {
|
|
24
|
-
showDiff: (config: PMDiffParams) => EditorCommand;
|
|
25
23
|
hideDiff: EditorCommand;
|
|
24
|
+
showDiff: (config: PMDiffParams) => EditorCommand;
|
|
26
25
|
};
|
|
26
|
+
pluginConfiguration: DiffParams | undefined;
|
|
27
27
|
sharedState: {
|
|
28
28
|
/**
|
|
29
29
|
* Whether the show diff feature is currently displaying changes.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-show-diff",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "ShowDiff plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"prosemirror-changeset": "^2.2.1"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"@atlaskit/editor-common": "^107.
|
|
40
|
+
"@atlaskit/editor-common": "^107.29.0",
|
|
41
41
|
"react": "^18.2.0"
|
|
42
42
|
},
|
|
43
43
|
"techstack": {
|