@atlaskit/editor-plugin-collab-edit 0.1.10 → 0.1.12
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 +14 -0
- package/dist/cjs/plugin.js +29 -12
- package/dist/cjs/pm-plugins/track-ncs-initialization.js +8 -0
- package/dist/es2019/plugin.js +17 -1
- package/dist/es2019/pm-plugins/track-ncs-initialization.js +8 -0
- package/dist/esm/plugin.js +29 -12
- package/dist/esm/pm-plugins/track-ncs-initialization.js +7 -0
- package/dist/types/types.d.ts +6 -0
- package/dist/types-ts4.5/types.d.ts +6 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-collab-edit
|
|
2
2
|
|
|
3
|
+
## 0.1.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#69825](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/69825) [`e2363da4f6a1`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/e2363da4f6a1) - [No Issue] Replace View Mode API for annotations
|
|
8
|
+
- [#69825](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/69825) [`e2363da4f6a1`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/e2363da4f6a1) - [No Issue] Replace View Mode API for annotations
|
|
9
|
+
- [#69825](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/69825) [`e2363da4f6a1`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/e2363da4f6a1) - [No Issue] Replace View Mode API for annotations
|
|
10
|
+
|
|
11
|
+
## 0.1.11
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#72026](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/72026) [`0a0cc061a8a7`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0a0cc061a8a7) - [No Issue] Improve Confluence Integration tests precision with data-has-collab-initialised
|
|
16
|
+
|
|
3
17
|
## 0.1.10
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -8,6 +8,7 @@ exports.collabEditPlugin = void 0;
|
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
10
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
|
+
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
11
12
|
var _prosemirrorCollab = require("@atlaskit/prosemirror-collab");
|
|
12
13
|
var _analytics = require("./analytics");
|
|
13
14
|
var _sendTransaction = require("./events/send-transaction");
|
|
@@ -56,10 +57,25 @@ var providerBuilder = function providerBuilder(collabEditProviderPromise) {
|
|
|
56
57
|
};
|
|
57
58
|
}();
|
|
58
59
|
};
|
|
59
|
-
var
|
|
60
|
+
var createAddInlineCommentMark = function createAddInlineCommentMark(providerPromise) {
|
|
61
|
+
return function (_ref2) {
|
|
62
|
+
var from = _ref2.from,
|
|
63
|
+
to = _ref2.to,
|
|
64
|
+
mark = _ref2.mark;
|
|
65
|
+
providerPromise.then(function (provider) {
|
|
66
|
+
var _provider$api;
|
|
67
|
+
var commentMark = new _transform.AddMarkStep(Math.min(from, to), Math.max(from, to), mark);
|
|
68
|
+
|
|
69
|
+
// @ts-expect-error 2339: Property 'api' does not exist on type 'CollabEditProvider<CollabEvents>'.
|
|
70
|
+
(_provider$api = provider.api) === null || _provider$api === void 0 || _provider$api.addComment([commentMark]);
|
|
71
|
+
});
|
|
72
|
+
return false;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
var collabEditPlugin = exports.collabEditPlugin = function collabEditPlugin(_ref3) {
|
|
60
76
|
var _api$featureFlags;
|
|
61
|
-
var options =
|
|
62
|
-
api =
|
|
77
|
+
var options = _ref3.config,
|
|
78
|
+
api = _ref3.api;
|
|
63
79
|
var featureFlags = (api === null || api === void 0 || (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
|
|
64
80
|
var providerResolver = function providerResolver() {};
|
|
65
81
|
var collabEditProviderPromise = new Promise(function (_providerResolver) {
|
|
@@ -91,14 +107,15 @@ var collabEditPlugin = exports.collabEditPlugin = function collabEditPlugin(_ref
|
|
|
91
107
|
};
|
|
92
108
|
},
|
|
93
109
|
actions: {
|
|
94
|
-
getAvatarColor: _utils.getAvatarColor
|
|
110
|
+
getAvatarColor: _utils.getAvatarColor,
|
|
111
|
+
addInlineCommentMark: createAddInlineCommentMark(collabEditProviderPromise)
|
|
95
112
|
},
|
|
96
113
|
pmPlugins: function pmPlugins() {
|
|
97
|
-
var
|
|
98
|
-
|
|
99
|
-
useNativePlugin =
|
|
100
|
-
|
|
101
|
-
userId =
|
|
114
|
+
var _ref4 = options || {},
|
|
115
|
+
_ref4$useNativePlugin = _ref4.useNativePlugin,
|
|
116
|
+
useNativePlugin = _ref4$useNativePlugin === void 0 ? false : _ref4$useNativePlugin,
|
|
117
|
+
_ref4$userId = _ref4.userId,
|
|
118
|
+
userId = _ref4$userId === void 0 ? null : _ref4$userId;
|
|
102
119
|
return [].concat((0, _toConsumableArray2.default)(useNativePlugin ? [{
|
|
103
120
|
name: 'pmCollab',
|
|
104
121
|
plugin: function plugin() {
|
|
@@ -115,9 +132,9 @@ var collabEditPlugin = exports.collabEditPlugin = function collabEditPlugin(_ref
|
|
|
115
132
|
}
|
|
116
133
|
}] : []), [{
|
|
117
134
|
name: 'collab',
|
|
118
|
-
plugin: function plugin(
|
|
119
|
-
var dispatch =
|
|
120
|
-
providerFactory =
|
|
135
|
+
plugin: function plugin(_ref5) {
|
|
136
|
+
var dispatch = _ref5.dispatch,
|
|
137
|
+
providerFactory = _ref5.providerFactory;
|
|
121
138
|
return (0, _main.createPlugin)(dispatch, providerFactory, providerResolver, executeProviderCode, options, featureFlags, api);
|
|
122
139
|
}
|
|
123
140
|
}, {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.trackNCSInitializationPluginKey = exports.createPlugin = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
7
9
|
var _collab = require("@atlaskit/editor-common/collab");
|
|
8
10
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
9
11
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
@@ -44,6 +46,12 @@ var createPlugin = exports.createPlugin = function createPlugin() {
|
|
|
44
46
|
}
|
|
45
47
|
return prevPluginState;
|
|
46
48
|
}
|
|
49
|
+
},
|
|
50
|
+
props: {
|
|
51
|
+
attributes: function attributes(editorState) {
|
|
52
|
+
var trackPluginState = trackNCSInitializationPluginKey.getState(editorState);
|
|
53
|
+
return (0, _defineProperty2.default)({}, 'data-has-collab-initialised', "".concat(Boolean(trackPluginState === null || trackPluginState === void 0 ? void 0 : trackPluginState.collabInitialisedAt)));
|
|
54
|
+
}
|
|
47
55
|
}
|
|
48
56
|
});
|
|
49
57
|
};
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AddMarkStep } from '@atlaskit/editor-prosemirror/transform';
|
|
1
2
|
import { collab } from '@atlaskit/prosemirror-collab';
|
|
2
3
|
import { addSynchronyErrorAnalytics } from './analytics';
|
|
3
4
|
import { sendTransaction } from './events/send-transaction';
|
|
@@ -21,6 +22,20 @@ const providerBuilder = collabEditProviderPromise => async (codeToExecute, onErr
|
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
24
|
};
|
|
25
|
+
const createAddInlineCommentMark = providerPromise => ({
|
|
26
|
+
from,
|
|
27
|
+
to,
|
|
28
|
+
mark
|
|
29
|
+
}) => {
|
|
30
|
+
providerPromise.then(provider => {
|
|
31
|
+
var _provider$api;
|
|
32
|
+
const commentMark = new AddMarkStep(Math.min(from, to), Math.max(from, to), mark);
|
|
33
|
+
|
|
34
|
+
// @ts-expect-error 2339: Property 'api' does not exist on type 'CollabEditProvider<CollabEvents>'.
|
|
35
|
+
(_provider$api = provider.api) === null || _provider$api === void 0 ? void 0 : _provider$api.addComment([commentMark]);
|
|
36
|
+
});
|
|
37
|
+
return false;
|
|
38
|
+
};
|
|
24
39
|
export const collabEditPlugin = ({
|
|
25
40
|
config: options,
|
|
26
41
|
api
|
|
@@ -57,7 +72,8 @@ export const collabEditPlugin = ({
|
|
|
57
72
|
};
|
|
58
73
|
},
|
|
59
74
|
actions: {
|
|
60
|
-
getAvatarColor
|
|
75
|
+
getAvatarColor,
|
|
76
|
+
addInlineCommentMark: createAddInlineCommentMark(collabEditProviderPromise)
|
|
61
77
|
},
|
|
62
78
|
pmPlugins() {
|
|
63
79
|
const {
|
|
@@ -38,6 +38,14 @@ export const createPlugin = () => {
|
|
|
38
38
|
}
|
|
39
39
|
return prevPluginState;
|
|
40
40
|
}
|
|
41
|
+
},
|
|
42
|
+
props: {
|
|
43
|
+
attributes(editorState) {
|
|
44
|
+
const trackPluginState = trackNCSInitializationPluginKey.getState(editorState);
|
|
45
|
+
return {
|
|
46
|
+
['data-has-collab-initialised']: `${Boolean(trackPluginState === null || trackPluginState === void 0 ? void 0 : trackPluginState.collabInitialisedAt)}`
|
|
47
|
+
};
|
|
48
|
+
}
|
|
41
49
|
}
|
|
42
50
|
});
|
|
43
51
|
};
|
package/dist/esm/plugin.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
3
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
|
+
import { AddMarkStep } from '@atlaskit/editor-prosemirror/transform';
|
|
4
5
|
import { collab } from '@atlaskit/prosemirror-collab';
|
|
5
6
|
import { addSynchronyErrorAnalytics } from './analytics';
|
|
6
7
|
import { sendTransaction } from './events/send-transaction';
|
|
@@ -49,10 +50,25 @@ var providerBuilder = function providerBuilder(collabEditProviderPromise) {
|
|
|
49
50
|
};
|
|
50
51
|
}();
|
|
51
52
|
};
|
|
52
|
-
|
|
53
|
+
var createAddInlineCommentMark = function createAddInlineCommentMark(providerPromise) {
|
|
54
|
+
return function (_ref2) {
|
|
55
|
+
var from = _ref2.from,
|
|
56
|
+
to = _ref2.to,
|
|
57
|
+
mark = _ref2.mark;
|
|
58
|
+
providerPromise.then(function (provider) {
|
|
59
|
+
var _provider$api;
|
|
60
|
+
var commentMark = new AddMarkStep(Math.min(from, to), Math.max(from, to), mark);
|
|
61
|
+
|
|
62
|
+
// @ts-expect-error 2339: Property 'api' does not exist on type 'CollabEditProvider<CollabEvents>'.
|
|
63
|
+
(_provider$api = provider.api) === null || _provider$api === void 0 || _provider$api.addComment([commentMark]);
|
|
64
|
+
});
|
|
65
|
+
return false;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
export var collabEditPlugin = function collabEditPlugin(_ref3) {
|
|
53
69
|
var _api$featureFlags;
|
|
54
|
-
var options =
|
|
55
|
-
api =
|
|
70
|
+
var options = _ref3.config,
|
|
71
|
+
api = _ref3.api;
|
|
56
72
|
var featureFlags = (api === null || api === void 0 || (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
|
|
57
73
|
var providerResolver = function providerResolver() {};
|
|
58
74
|
var collabEditProviderPromise = new Promise(function (_providerResolver) {
|
|
@@ -84,14 +100,15 @@ export var collabEditPlugin = function collabEditPlugin(_ref2) {
|
|
|
84
100
|
};
|
|
85
101
|
},
|
|
86
102
|
actions: {
|
|
87
|
-
getAvatarColor: getAvatarColor
|
|
103
|
+
getAvatarColor: getAvatarColor,
|
|
104
|
+
addInlineCommentMark: createAddInlineCommentMark(collabEditProviderPromise)
|
|
88
105
|
},
|
|
89
106
|
pmPlugins: function pmPlugins() {
|
|
90
|
-
var
|
|
91
|
-
|
|
92
|
-
useNativePlugin =
|
|
93
|
-
|
|
94
|
-
userId =
|
|
107
|
+
var _ref4 = options || {},
|
|
108
|
+
_ref4$useNativePlugin = _ref4.useNativePlugin,
|
|
109
|
+
useNativePlugin = _ref4$useNativePlugin === void 0 ? false : _ref4$useNativePlugin,
|
|
110
|
+
_ref4$userId = _ref4.userId,
|
|
111
|
+
userId = _ref4$userId === void 0 ? null : _ref4$userId;
|
|
95
112
|
return [].concat(_toConsumableArray(useNativePlugin ? [{
|
|
96
113
|
name: 'pmCollab',
|
|
97
114
|
plugin: function plugin() {
|
|
@@ -108,9 +125,9 @@ export var collabEditPlugin = function collabEditPlugin(_ref2) {
|
|
|
108
125
|
}
|
|
109
126
|
}] : []), [{
|
|
110
127
|
name: 'collab',
|
|
111
|
-
plugin: function plugin(
|
|
112
|
-
var dispatch =
|
|
113
|
-
providerFactory =
|
|
128
|
+
plugin: function plugin(_ref5) {
|
|
129
|
+
var dispatch = _ref5.dispatch,
|
|
130
|
+
providerFactory = _ref5.providerFactory;
|
|
114
131
|
return createPlugin(dispatch, providerFactory, providerResolver, executeProviderCode, options, featureFlags, api);
|
|
115
132
|
}
|
|
116
133
|
}, {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
1
2
|
import { isDirtyTransaction } from '@atlaskit/editor-common/collab';
|
|
2
3
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
4
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
@@ -38,6 +39,12 @@ export var createPlugin = function createPlugin() {
|
|
|
38
39
|
}
|
|
39
40
|
return prevPluginState;
|
|
40
41
|
}
|
|
42
|
+
},
|
|
43
|
+
props: {
|
|
44
|
+
attributes: function attributes(editorState) {
|
|
45
|
+
var trackPluginState = trackNCSInitializationPluginKey.getState(editorState);
|
|
46
|
+
return _defineProperty({}, 'data-has-collab-initialised', "".concat(Boolean(trackPluginState === null || trackPluginState === void 0 ? void 0 : trackPluginState.collabInitialisedAt)));
|
|
47
|
+
}
|
|
41
48
|
}
|
|
42
49
|
});
|
|
43
50
|
};
|
package/dist/types/types.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { CollabEditOptions, CollabEditProvider, CollabParticipant, Color, S
|
|
|
2
2
|
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
4
4
|
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
5
|
+
import type { Mark } from '@atlaskit/editor-prosemirror/model';
|
|
5
6
|
export type { InviteToEditComponentProps, InviteToEditButtonProps, CollabInviteToEditProps, CollabAnalyticsProps, } from '@atlaskit/editor-common/collab';
|
|
6
7
|
export type PrivateCollabEditOptions = CollabEditOptions & {
|
|
7
8
|
sanitizePrivateContent?: boolean;
|
|
@@ -35,5 +36,10 @@ export type CollabEditPlugin = NextEditorPlugin<'collabEdit', {
|
|
|
35
36
|
index: number;
|
|
36
37
|
color: Color;
|
|
37
38
|
};
|
|
39
|
+
addInlineCommentMark: (props: {
|
|
40
|
+
from: number;
|
|
41
|
+
to: number;
|
|
42
|
+
mark: Mark;
|
|
43
|
+
}) => boolean;
|
|
38
44
|
};
|
|
39
45
|
}>;
|
|
@@ -2,6 +2,7 @@ import type { CollabEditOptions, CollabEditProvider, CollabParticipant, Color, S
|
|
|
2
2
|
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
4
4
|
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
5
|
+
import type { Mark } from '@atlaskit/editor-prosemirror/model';
|
|
5
6
|
export type { InviteToEditComponentProps, InviteToEditButtonProps, CollabInviteToEditProps, CollabAnalyticsProps, } from '@atlaskit/editor-common/collab';
|
|
6
7
|
export type PrivateCollabEditOptions = CollabEditOptions & {
|
|
7
8
|
sanitizePrivateContent?: boolean;
|
|
@@ -35,5 +36,10 @@ export type CollabEditPlugin = NextEditorPlugin<'collabEdit', {
|
|
|
35
36
|
index: number;
|
|
36
37
|
color: Color;
|
|
37
38
|
};
|
|
39
|
+
addInlineCommentMark: (props: {
|
|
40
|
+
from: number;
|
|
41
|
+
to: number;
|
|
42
|
+
mark: Mark;
|
|
43
|
+
}) => boolean;
|
|
38
44
|
};
|
|
39
45
|
}>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-collab-edit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12",
|
|
4
4
|
"description": "Collab Edit plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
".": "./src/index.ts"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@atlaskit/editor-common": "^77.
|
|
35
|
+
"@atlaskit/editor-common": "^77.4.0",
|
|
36
36
|
"@atlaskit/editor-plugin-analytics": "0.4.7",
|
|
37
37
|
"@atlaskit/editor-plugin-feature-flags": "^1.0.0",
|
|
38
38
|
"@atlaskit/editor-prosemirror": "3.0.0",
|