@atlaskit/editor-plugin-collab-edit 1.4.3 → 1.5.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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @atlaskit/editor-plugin-collab-edit
2
2
 
3
+ ## 1.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#106594](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/106594)
8
+ [`554be969a7b69`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/554be969a7b69) -
9
+ Support comments on media in Live View mode
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
15
+ ## 1.4.4
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies
20
+
3
21
  ## 1.4.3
4
22
 
5
23
  ### Patch Changes
@@ -72,10 +72,24 @@ var createAddInlineCommentMark = function createAddInlineCommentMark(providerPro
72
72
  return false;
73
73
  };
74
74
  };
75
- var collabEditPlugin = exports.collabEditPlugin = function collabEditPlugin(_ref3) {
75
+ var createAddInlineCommentNodeMark = function createAddInlineCommentNodeMark(providerPromise) {
76
+ return function (_ref3) {
77
+ var pos = _ref3.pos,
78
+ mark = _ref3.mark;
79
+ providerPromise.then(function (provider) {
80
+ var _provider$api2;
81
+ var commentMark = new _transform.AddNodeMarkStep(pos, mark);
82
+
83
+ // @ts-expect-error 2339: Property 'api' does not exist on type 'CollabEditProvider<CollabEvents>'.
84
+ (_provider$api2 = provider.api) === null || _provider$api2 === void 0 || _provider$api2.addComment([commentMark]);
85
+ });
86
+ return false;
87
+ };
88
+ };
89
+ var collabEditPlugin = exports.collabEditPlugin = function collabEditPlugin(_ref4) {
76
90
  var _api$featureFlags;
77
- var options = _ref3.config,
78
- api = _ref3.api;
91
+ var options = _ref4.config,
92
+ api = _ref4.api;
79
93
  var featureFlags = (api === null || api === void 0 || (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
80
94
  var providerResolver = function providerResolver() {};
81
95
  var collabEditProviderPromise = new Promise(function (_providerResolver) {
@@ -111,16 +125,17 @@ var collabEditPlugin = exports.collabEditPlugin = function collabEditPlugin(_ref
111
125
  actions: {
112
126
  getAvatarColor: _utils.getAvatarColor,
113
127
  addInlineCommentMark: createAddInlineCommentMark(collabEditProviderPromise),
128
+ addInlineCommentNodeMark: createAddInlineCommentNodeMark(collabEditProviderPromise),
114
129
  isRemoteReplaceDocumentTransaction: function isRemoteReplaceDocumentTransaction(tr) {
115
130
  return tr.getMeta('isRemote') && tr.getMeta('replaceDocument');
116
131
  }
117
132
  },
118
133
  pmPlugins: function pmPlugins() {
119
- var _ref4 = options || {},
120
- _ref4$useNativePlugin = _ref4.useNativePlugin,
121
- useNativePlugin = _ref4$useNativePlugin === void 0 ? false : _ref4$useNativePlugin,
122
- _ref4$userId = _ref4.userId,
123
- userId = _ref4$userId === void 0 ? null : _ref4$userId;
134
+ var _ref5 = options || {},
135
+ _ref5$useNativePlugin = _ref5.useNativePlugin,
136
+ useNativePlugin = _ref5$useNativePlugin === void 0 ? false : _ref5$useNativePlugin,
137
+ _ref5$userId = _ref5.userId,
138
+ userId = _ref5$userId === void 0 ? null : _ref5$userId;
124
139
  return [].concat((0, _toConsumableArray2.default)(useNativePlugin ? [{
125
140
  name: 'pmCollab',
126
141
  plugin: function plugin() {
@@ -137,9 +152,9 @@ var collabEditPlugin = exports.collabEditPlugin = function collabEditPlugin(_ref
137
152
  }
138
153
  }] : []), [{
139
154
  name: 'collab',
140
- plugin: function plugin(_ref5) {
141
- var dispatch = _ref5.dispatch,
142
- providerFactory = _ref5.providerFactory;
155
+ plugin: function plugin(_ref6) {
156
+ var dispatch = _ref6.dispatch,
157
+ providerFactory = _ref6.providerFactory;
143
158
  return (0, _main.createPlugin)(dispatch, providerFactory, providerResolver, executeProviderCode, options, featureFlags, api);
144
159
  }
145
160
  }, {
@@ -1,4 +1,4 @@
1
- import { AddMarkStep } from '@atlaskit/editor-prosemirror/transform';
1
+ import { AddMarkStep, AddNodeMarkStep } from '@atlaskit/editor-prosemirror/transform';
2
2
  import { collab } from '@atlaskit/prosemirror-collab';
3
3
  import { addSynchronyErrorAnalytics } from './analytics';
4
4
  import { sendTransaction } from './events/send-transaction';
@@ -36,6 +36,19 @@ const createAddInlineCommentMark = providerPromise => ({
36
36
  });
37
37
  return false;
38
38
  };
39
+ const createAddInlineCommentNodeMark = providerPromise => ({
40
+ pos,
41
+ mark
42
+ }) => {
43
+ providerPromise.then(provider => {
44
+ var _provider$api2;
45
+ const commentMark = new AddNodeMarkStep(pos, mark);
46
+
47
+ // @ts-expect-error 2339: Property 'api' does not exist on type 'CollabEditProvider<CollabEvents>'.
48
+ (_provider$api2 = provider.api) === null || _provider$api2 === void 0 ? void 0 : _provider$api2.addComment([commentMark]);
49
+ });
50
+ return false;
51
+ };
39
52
  export const collabEditPlugin = ({
40
53
  config: options,
41
54
  api
@@ -76,6 +89,7 @@ export const collabEditPlugin = ({
76
89
  actions: {
77
90
  getAvatarColor,
78
91
  addInlineCommentMark: createAddInlineCommentMark(collabEditProviderPromise),
92
+ addInlineCommentNodeMark: createAddInlineCommentNodeMark(collabEditProviderPromise),
79
93
  isRemoteReplaceDocumentTransaction: tr => tr.getMeta('isRemote') && tr.getMeta('replaceDocument')
80
94
  },
81
95
  pmPlugins() {
@@ -1,7 +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
+ import { AddMarkStep, AddNodeMarkStep } from '@atlaskit/editor-prosemirror/transform';
5
5
  import { collab } from '@atlaskit/prosemirror-collab';
6
6
  import { addSynchronyErrorAnalytics } from './analytics';
7
7
  import { sendTransaction } from './events/send-transaction';
@@ -65,10 +65,24 @@ var createAddInlineCommentMark = function createAddInlineCommentMark(providerPro
65
65
  return false;
66
66
  };
67
67
  };
68
- export var collabEditPlugin = function collabEditPlugin(_ref3) {
68
+ var createAddInlineCommentNodeMark = function createAddInlineCommentNodeMark(providerPromise) {
69
+ return function (_ref3) {
70
+ var pos = _ref3.pos,
71
+ mark = _ref3.mark;
72
+ providerPromise.then(function (provider) {
73
+ var _provider$api2;
74
+ var commentMark = new AddNodeMarkStep(pos, mark);
75
+
76
+ // @ts-expect-error 2339: Property 'api' does not exist on type 'CollabEditProvider<CollabEvents>'.
77
+ (_provider$api2 = provider.api) === null || _provider$api2 === void 0 || _provider$api2.addComment([commentMark]);
78
+ });
79
+ return false;
80
+ };
81
+ };
82
+ export var collabEditPlugin = function collabEditPlugin(_ref4) {
69
83
  var _api$featureFlags;
70
- var options = _ref3.config,
71
- api = _ref3.api;
84
+ var options = _ref4.config,
85
+ api = _ref4.api;
72
86
  var featureFlags = (api === null || api === void 0 || (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
73
87
  var providerResolver = function providerResolver() {};
74
88
  var collabEditProviderPromise = new Promise(function (_providerResolver) {
@@ -104,16 +118,17 @@ export var collabEditPlugin = function collabEditPlugin(_ref3) {
104
118
  actions: {
105
119
  getAvatarColor: getAvatarColor,
106
120
  addInlineCommentMark: createAddInlineCommentMark(collabEditProviderPromise),
121
+ addInlineCommentNodeMark: createAddInlineCommentNodeMark(collabEditProviderPromise),
107
122
  isRemoteReplaceDocumentTransaction: function isRemoteReplaceDocumentTransaction(tr) {
108
123
  return tr.getMeta('isRemote') && tr.getMeta('replaceDocument');
109
124
  }
110
125
  },
111
126
  pmPlugins: function pmPlugins() {
112
- var _ref4 = options || {},
113
- _ref4$useNativePlugin = _ref4.useNativePlugin,
114
- useNativePlugin = _ref4$useNativePlugin === void 0 ? false : _ref4$useNativePlugin,
115
- _ref4$userId = _ref4.userId,
116
- userId = _ref4$userId === void 0 ? null : _ref4$userId;
127
+ var _ref5 = options || {},
128
+ _ref5$useNativePlugin = _ref5.useNativePlugin,
129
+ useNativePlugin = _ref5$useNativePlugin === void 0 ? false : _ref5$useNativePlugin,
130
+ _ref5$userId = _ref5.userId,
131
+ userId = _ref5$userId === void 0 ? null : _ref5$userId;
117
132
  return [].concat(_toConsumableArray(useNativePlugin ? [{
118
133
  name: 'pmCollab',
119
134
  plugin: function plugin() {
@@ -130,9 +145,9 @@ export var collabEditPlugin = function collabEditPlugin(_ref3) {
130
145
  }
131
146
  }] : []), [{
132
147
  name: 'collab',
133
- plugin: function plugin(_ref5) {
134
- var dispatch = _ref5.dispatch,
135
- providerFactory = _ref5.providerFactory;
148
+ plugin: function plugin(_ref6) {
149
+ var dispatch = _ref6.dispatch,
150
+ providerFactory = _ref6.providerFactory;
136
151
  return createPlugin(dispatch, providerFactory, providerResolver, executeProviderCode, options, featureFlags, api);
137
152
  }
138
153
  }, {
@@ -40,6 +40,10 @@ export type CollabEditPlugin = NextEditorPlugin<'collabEdit', {
40
40
  to: number;
41
41
  mark: Mark;
42
42
  }) => boolean;
43
+ addInlineCommentNodeMark: (props: {
44
+ pos: number;
45
+ mark: Mark;
46
+ }) => boolean;
43
47
  isRemoteReplaceDocumentTransaction: (tr: Transaction) => boolean;
44
48
  };
45
49
  }>;
@@ -43,6 +43,10 @@ export type CollabEditPlugin = NextEditorPlugin<'collabEdit', {
43
43
  to: number;
44
44
  mark: Mark;
45
45
  }) => boolean;
46
+ addInlineCommentNodeMark: (props: {
47
+ pos: number;
48
+ mark: Mark;
49
+ }) => boolean;
46
50
  isRemoteReplaceDocumentTransaction: (tr: Transaction) => boolean;
47
51
  };
48
52
  }>;
package/package.json CHANGED
@@ -1,100 +1,80 @@
1
1
  {
2
- "name": "@atlaskit/editor-plugin-collab-edit",
3
- "version": "1.4.3",
4
- "description": "Collab Edit plugin for @atlaskit/editor-core",
5
- "author": "Atlassian Pty Ltd",
6
- "license": "Apache-2.0",
7
- "publishConfig": {
8
- "registry": "https://registry.npmjs.org/"
9
- },
10
- "atlassian": {
11
- "team": "Editor: Collaboration",
12
- "singleton": true,
13
- "inPublicMirror": false,
14
- "releaseModel": "continuous"
15
- },
16
- "repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
17
- "main": "dist/cjs/index.js",
18
- "module": "dist/esm/index.js",
19
- "module:es2019": "dist/es2019/index.js",
20
- "types": "dist/types/index.d.ts",
21
- "typesVersions": {
22
- ">=4.5 <4.9": {
23
- "*": [
24
- "dist/types-ts4.5/*",
25
- "dist/types-ts4.5/index.d.ts"
26
- ]
27
- }
28
- },
29
- "sideEffects": false,
30
- "atlaskit:src": "src/index.ts",
31
- "af:exports": {
32
- ".": "./src/index.ts"
33
- },
34
- "dependencies": {
35
- "@atlaskit/adf-schema": "^36.10.7",
36
- "@atlaskit/custom-steps": "^0.2.0",
37
- "@atlaskit/editor-common": "^81.2.0",
38
- "@atlaskit/editor-plugin-analytics": "1.2.2",
39
- "@atlaskit/editor-plugin-feature-flags": "^1.1.0",
40
- "@atlaskit/editor-prosemirror": "4.0.1",
41
- "@atlaskit/editor-shared-styles": "^2.11.0",
42
- "@atlaskit/prosemirror-collab": "^0.4.0",
43
- "@babel/runtime": "^7.0.0",
44
- "memoize-one": "^6.0.0"
45
- },
46
- "peerDependencies": {
47
- "react": "^16.8.0"
48
- },
49
- "devDependencies": {
50
- "@af/integration-testing": "*",
51
- "@af/visual-regression": "*",
52
- "@atlaskit/editor-plugin-mentions": "^1.5.0",
53
- "@atlaskit/editor-plugin-text-formatting": "^1.7.0",
54
- "@atlaskit/editor-plugin-type-ahead": "^1.2.0",
55
- "@atlaskit/editor-plugin-unsupported-content": "^1.2.0",
56
- "@atlaskit/editor-test-helpers": "^18.23.0",
57
- "@atlaskit/ssr": "*",
58
- "@atlaskit/synchrony-test-helpers": "^2.4.0",
59
- "@atlaskit/util-data-test": "^17.9.0",
60
- "@atlaskit/visual-regression": "*",
61
- "@atlaskit/webdriver-runner": "*",
62
- "@testing-library/react": "^12.1.5",
63
- "react-dom": "^16.8.0",
64
- "typescript": "~5.4.2",
65
- "wait-for-expect": "^1.2.0"
66
- },
67
- "techstack": {
68
- "@atlassian/frontend": {
69
- "import-structure": [
70
- "atlassian-conventions"
71
- ],
72
- "circular-dependencies": [
73
- "file-and-folder-level"
74
- ]
75
- },
76
- "@repo/internal": {
77
- "dom-events": "use-bind-event-listener",
78
- "analytics": [
79
- "analytics-next"
80
- ],
81
- "design-tokens": [
82
- "color"
83
- ],
84
- "theming": [
85
- "react-context"
86
- ],
87
- "ui-components": [
88
- "lite-mode"
89
- ],
90
- "deprecation": "no-deprecated-imports",
91
- "styling": [
92
- "emotion",
93
- "emotion"
94
- ],
95
- "imports": [
96
- "import-no-extraneous-disable-for-examples-and-docs"
97
- ]
98
- }
99
- }
100
- }
2
+ "name": "@atlaskit/editor-plugin-collab-edit",
3
+ "version": "1.5.0",
4
+ "description": "Collab Edit plugin for @atlaskit/editor-core",
5
+ "author": "Atlassian Pty Ltd",
6
+ "license": "Apache-2.0",
7
+ "publishConfig": {
8
+ "registry": "https://registry.npmjs.org/"
9
+ },
10
+ "atlassian": {
11
+ "team": "Editor: Collaboration",
12
+ "singleton": true,
13
+ "inPublicMirror": false,
14
+ "releaseModel": "continuous"
15
+ },
16
+ "repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
17
+ "main": "dist/cjs/index.js",
18
+ "module": "dist/esm/index.js",
19
+ "module:es2019": "dist/es2019/index.js",
20
+ "types": "dist/types/index.d.ts",
21
+ "typesVersions": {
22
+ ">=4.5 <4.9": {
23
+ "*": ["dist/types-ts4.5/*", "dist/types-ts4.5/index.d.ts"]
24
+ }
25
+ },
26
+ "sideEffects": false,
27
+ "atlaskit:src": "src/index.ts",
28
+ "af:exports": {
29
+ ".": "./src/index.ts"
30
+ },
31
+ "dependencies": {
32
+ "@atlaskit/adf-schema": "^36.10.7",
33
+ "@atlaskit/custom-steps": "^0.2.0",
34
+ "@atlaskit/editor-common": "^82.6.0",
35
+ "@atlaskit/editor-plugin-analytics": "1.2.3",
36
+ "@atlaskit/editor-plugin-feature-flags": "^1.1.0",
37
+ "@atlaskit/editor-prosemirror": "4.0.1",
38
+ "@atlaskit/editor-shared-styles": "^2.12.0",
39
+ "@atlaskit/prosemirror-collab": "^0.4.0",
40
+ "@babel/runtime": "^7.0.0",
41
+ "memoize-one": "^6.0.0"
42
+ },
43
+ "peerDependencies": {
44
+ "react": "^16.8.0"
45
+ },
46
+ "devDependencies": {
47
+ "@af/integration-testing": "*",
48
+ "@af/visual-regression": "*",
49
+ "@atlaskit/editor-plugin-mentions": "^1.6.0",
50
+ "@atlaskit/editor-plugin-text-formatting": "^1.7.0",
51
+ "@atlaskit/editor-plugin-type-ahead": "^1.2.0",
52
+ "@atlaskit/editor-plugin-unsupported-content": "^1.2.0",
53
+ "@atlaskit/editor-test-helpers": "^18.23.0",
54
+ "@atlaskit/ssr": "*",
55
+ "@atlaskit/synchrony-test-helpers": "^2.4.0",
56
+ "@atlaskit/util-data-test": "^17.9.0",
57
+ "@atlaskit/visual-regression": "*",
58
+ "@atlaskit/webdriver-runner": "*",
59
+ "@testing-library/react": "^12.1.5",
60
+ "react-dom": "^16.8.0",
61
+ "typescript": "~5.4.2",
62
+ "wait-for-expect": "^1.2.0"
63
+ },
64
+ "techstack": {
65
+ "@atlassian/frontend": {
66
+ "import-structure": ["atlassian-conventions"],
67
+ "circular-dependencies": ["file-and-folder-level"]
68
+ },
69
+ "@repo/internal": {
70
+ "dom-events": "use-bind-event-listener",
71
+ "analytics": ["analytics-next"],
72
+ "design-tokens": ["color"],
73
+ "theming": ["react-context"],
74
+ "ui-components": ["lite-mode"],
75
+ "deprecation": "no-deprecated-imports",
76
+ "styling": ["emotion", "emotion"],
77
+ "imports": ["import-no-extraneous-disable-for-examples-and-docs"]
78
+ }
79
+ }
80
+ }