@atlaskit/editor-plugin-annotation 1.28.1 → 2.0.1
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 +27 -0
- package/dist/cjs/annotationPlugin.js +2 -8
- package/dist/cjs/nodeviews/index.js +1 -47
- package/dist/cjs/pm-plugins/inline-comment.js +2 -13
- package/dist/cjs/types/index.js +1 -1
- package/dist/es2019/annotationPlugin.js +2 -8
- package/dist/es2019/nodeviews/index.js +0 -26
- package/dist/es2019/pm-plugins/inline-comment.js +1 -9
- package/dist/es2019/types/index.js +1 -1
- package/dist/esm/annotationPlugin.js +2 -8
- package/dist/esm/nodeviews/index.js +0 -45
- package/dist/esm/pm-plugins/inline-comment.js +3 -14
- package/dist/esm/types/index.js +1 -1
- package/dist/types/nodeviews/index.d.ts +0 -10
- package/dist/types/pm-plugins/types.d.ts +1 -4
- package/dist/types-ts4.5/nodeviews/index.d.ts +0 -10
- package/dist/types-ts4.5/pm-plugins/types.d.ts +1 -4
- package/package.json +11 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-annotation
|
|
2
2
|
|
|
3
|
+
## 2.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#117936](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/117936)
|
|
8
|
+
[`f9d438f975b72`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f9d438f975b72) -
|
|
9
|
+
Cleanup react 18 annotation nodeview memory leak.
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 2.0.0
|
|
13
|
+
|
|
14
|
+
### Major Changes
|
|
15
|
+
|
|
16
|
+
- [#117363](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/117363)
|
|
17
|
+
[`10a0f7f6c2027`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/10a0f7f6c2027) -
|
|
18
|
+
This package's `peerDependencies` have been adjusted for `react` and/or `react-dom` to reflect the
|
|
19
|
+
status of only supporting React 18 going forward. No explicit breaking change to React support has
|
|
20
|
+
been made in this release, but this is to signify going forward, breaking changes for React 16 or
|
|
21
|
+
React 17 may come via non-major semver releases.
|
|
22
|
+
|
|
23
|
+
Please refer this community post for more details:
|
|
24
|
+
https://community.developer.atlassian.com/t/rfc-78-dropping-support-for-react-16-and-rendering-in-a-react-18-concurrent-root-in-jira-and-confluence/87026
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- Updated dependencies
|
|
29
|
+
|
|
3
30
|
## 1.28.1
|
|
4
31
|
|
|
5
32
|
### Patch Changes
|
|
@@ -7,9 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.annotationPlugin = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
|
-
var _adfSchema = require("@atlaskit/adf-schema");
|
|
11
10
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
12
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
11
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
14
12
|
var _editorCommands = require("./editor-commands");
|
|
15
13
|
var _annotationMark = require("./nodeviews/annotationMark");
|
|
@@ -30,7 +28,7 @@ var annotationPlugin = exports.annotationPlugin = function annotationPlugin(_ref
|
|
|
30
28
|
marks: function marks() {
|
|
31
29
|
return [{
|
|
32
30
|
name: 'annotation',
|
|
33
|
-
mark:
|
|
31
|
+
mark: _annotationMark.annotationWithToDOMFix
|
|
34
32
|
}];
|
|
35
33
|
},
|
|
36
34
|
actions: {
|
|
@@ -51,15 +49,11 @@ var annotationPlugin = exports.annotationPlugin = function annotationPlugin(_ref
|
|
|
51
49
|
return [{
|
|
52
50
|
name: 'annotation',
|
|
53
51
|
plugin: function plugin(_ref2) {
|
|
54
|
-
var dispatch = _ref2.dispatch
|
|
55
|
-
portalProviderAPI = _ref2.portalProviderAPI,
|
|
56
|
-
eventDispatcher = _ref2.eventDispatcher;
|
|
52
|
+
var dispatch = _ref2.dispatch;
|
|
57
53
|
if (annotationProviders) {
|
|
58
54
|
var _api$analytics2;
|
|
59
55
|
return (0, _inlineComment.inlineCommentPlugin)({
|
|
60
56
|
dispatch: dispatch,
|
|
61
|
-
portalProviderAPI: portalProviderAPI,
|
|
62
|
-
eventDispatcher: eventDispatcher,
|
|
63
57
|
provider: annotationProviders.inlineComment,
|
|
64
58
|
editorAnalyticsAPI: api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions,
|
|
65
59
|
featureFlagsPluginState: featureFlags
|
|
@@ -1,56 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
|
-
exports.getBlockAnnotationViewClassname = exports.getAnnotationViewClassname =
|
|
8
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
11
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
12
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
13
|
-
var _react = _interopRequireDefault(require("react"));
|
|
14
|
-
var _reactNodeView = _interopRequireDefault(require("@atlaskit/editor-common/react-node-view"));
|
|
6
|
+
exports.getBlockAnnotationViewClassname = exports.getAnnotationViewClassname = void 0;
|
|
15
7
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
16
|
-
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
17
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
18
|
-
var AnnotationNodeView = exports.AnnotationNodeView = /*#__PURE__*/function (_ReactNodeView) {
|
|
19
|
-
function AnnotationNodeView() {
|
|
20
|
-
(0, _classCallCheck2.default)(this, AnnotationNodeView);
|
|
21
|
-
return _callSuper(this, AnnotationNodeView, arguments);
|
|
22
|
-
}
|
|
23
|
-
(0, _inherits2.default)(AnnotationNodeView, _ReactNodeView);
|
|
24
|
-
return (0, _createClass2.default)(AnnotationNodeView, [{
|
|
25
|
-
key: "createDomRef",
|
|
26
|
-
value: function createDomRef() {
|
|
27
|
-
return document.createElement('span');
|
|
28
|
-
}
|
|
29
|
-
}, {
|
|
30
|
-
key: "getContentDOM",
|
|
31
|
-
value: function getContentDOM() {
|
|
32
|
-
var dom = document.createElement('span');
|
|
33
|
-
dom.className = 'ak-editor-annotation';
|
|
34
|
-
return {
|
|
35
|
-
dom: dom
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
}, {
|
|
39
|
-
key: "render",
|
|
40
|
-
value: function render(_props, forwardRef) {
|
|
41
|
-
return (
|
|
42
|
-
/*#__PURE__*/
|
|
43
|
-
// all inline comment states are now set in decorations at ../pm-plugins/inline-comment.ts
|
|
44
|
-
_react.default.createElement("span", {
|
|
45
|
-
"data-mark-type": "annotation",
|
|
46
|
-
"data-id": this.node.attrs.id,
|
|
47
|
-
"data-mark-annotation-type": this.node.attrs.annotationType,
|
|
48
|
-
ref: forwardRef
|
|
49
|
-
})
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
}]);
|
|
53
|
-
}(_reactNodeView.default);
|
|
54
8
|
var getAnnotationViewClassname = exports.getAnnotationViewClassname = function getAnnotationViewClassname(isUnresolved, hasFocus, isHovered) {
|
|
55
9
|
if (!isUnresolved) {
|
|
56
10
|
return;
|
|
@@ -17,8 +17,6 @@ var _editorCommands = require("../editor-commands");
|
|
|
17
17
|
var _nodeviews = require("../nodeviews");
|
|
18
18
|
var _pluginFactory = require("./plugin-factory");
|
|
19
19
|
var _utils = require("./utils");
|
|
20
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
21
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
22
20
|
var fetchProviderStates = /*#__PURE__*/function () {
|
|
23
21
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(provider, annotationIds) {
|
|
24
22
|
var data, result;
|
|
@@ -158,8 +156,6 @@ var onSetVisibility = function onSetVisibility(view) {
|
|
|
158
156
|
};
|
|
159
157
|
var inlineCommentPlugin = exports.inlineCommentPlugin = function inlineCommentPlugin(options) {
|
|
160
158
|
var provider = options.provider,
|
|
161
|
-
portalProviderAPI = options.portalProviderAPI,
|
|
162
|
-
eventDispatcher = options.eventDispatcher,
|
|
163
159
|
featureFlagsPluginState = options.featureFlagsPluginState;
|
|
164
160
|
return new _safePlugin.SafePlugin({
|
|
165
161
|
key: _utils.inlineCommentPluginKey,
|
|
@@ -223,14 +219,7 @@ var inlineCommentPlugin = exports.inlineCommentPlugin = function inlineCommentPl
|
|
|
223
219
|
}
|
|
224
220
|
};
|
|
225
221
|
},
|
|
226
|
-
props:
|
|
227
|
-
nodeViews: {
|
|
228
|
-
annotation: function annotation(node, view, getPos) {
|
|
229
|
-
return new _nodeviews.AnnotationNodeView(node, view, getPos, portalProviderAPI, eventDispatcher) // resolved
|
|
230
|
-
.init();
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
}), {}, {
|
|
222
|
+
props: {
|
|
234
223
|
handleDOMEvents: {
|
|
235
224
|
mousedown: function mousedown(view) {
|
|
236
225
|
var pluginState = (0, _utils.getPluginState)(view.state);
|
|
@@ -308,6 +297,6 @@ var inlineCommentPlugin = exports.inlineCommentPlugin = function inlineCommentPl
|
|
|
308
297
|
decorations = decorations.add(state.doc, focusDecorations);
|
|
309
298
|
return decorations;
|
|
310
299
|
}
|
|
311
|
-
}
|
|
300
|
+
}
|
|
312
301
|
});
|
|
313
302
|
};
|
package/dist/cjs/types/index.js
CHANGED
|
@@ -16,7 +16,7 @@ var AnnotationSelectionType = exports.AnnotationSelectionType = /*#__PURE__*/fun
|
|
|
16
16
|
AnnotationSelectionType["DISABLED"] = "disabled";
|
|
17
17
|
AnnotationSelectionType["VALID"] = "valid";
|
|
18
18
|
return AnnotationSelectionType;
|
|
19
|
-
}({});
|
|
19
|
+
}({});
|
|
20
20
|
var prefix = 'ak-editor-annotation';
|
|
21
21
|
var AnnotationTestIds = exports.AnnotationTestIds = {
|
|
22
22
|
prefix: prefix,
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { annotation } from '@atlaskit/adf-schema';
|
|
3
2
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
4
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
3
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
6
4
|
import { setInlineCommentDraftState, showInlineCommentForBlockNode } from './editor-commands';
|
|
7
5
|
import { annotationWithToDOMFix } from './nodeviews/annotationMark';
|
|
@@ -21,7 +19,7 @@ export const annotationPlugin = ({
|
|
|
21
19
|
marks() {
|
|
22
20
|
return [{
|
|
23
21
|
name: 'annotation',
|
|
24
|
-
mark:
|
|
22
|
+
mark: annotationWithToDOMFix
|
|
25
23
|
}];
|
|
26
24
|
},
|
|
27
25
|
actions: {
|
|
@@ -41,16 +39,12 @@ export const annotationPlugin = ({
|
|
|
41
39
|
pmPlugins: () => [{
|
|
42
40
|
name: 'annotation',
|
|
43
41
|
plugin: ({
|
|
44
|
-
dispatch
|
|
45
|
-
portalProviderAPI,
|
|
46
|
-
eventDispatcher
|
|
42
|
+
dispatch
|
|
47
43
|
}) => {
|
|
48
44
|
if (annotationProviders) {
|
|
49
45
|
var _api$analytics2;
|
|
50
46
|
return inlineCommentPlugin({
|
|
51
47
|
dispatch,
|
|
52
|
-
portalProviderAPI,
|
|
53
|
-
eventDispatcher,
|
|
54
48
|
provider: annotationProviders.inlineComment,
|
|
55
49
|
editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions,
|
|
56
50
|
featureFlagsPluginState: featureFlags
|
|
@@ -1,30 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
3
1
|
import { AnnotationSharedClassNames, BlockAnnotationSharedClassNames } from '@atlaskit/editor-common/styles';
|
|
4
|
-
export class AnnotationNodeView extends ReactNodeView {
|
|
5
|
-
createDomRef() {
|
|
6
|
-
return document.createElement('span');
|
|
7
|
-
}
|
|
8
|
-
getContentDOM() {
|
|
9
|
-
const dom = document.createElement('span');
|
|
10
|
-
dom.className = 'ak-editor-annotation';
|
|
11
|
-
return {
|
|
12
|
-
dom
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
render(_props, forwardRef) {
|
|
16
|
-
return (
|
|
17
|
-
/*#__PURE__*/
|
|
18
|
-
// all inline comment states are now set in decorations at ../pm-plugins/inline-comment.ts
|
|
19
|
-
React.createElement("span", {
|
|
20
|
-
"data-mark-type": "annotation",
|
|
21
|
-
"data-id": this.node.attrs.id,
|
|
22
|
-
"data-mark-annotation-type": this.node.attrs.annotationType,
|
|
23
|
-
ref: forwardRef
|
|
24
|
-
})
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
2
|
export const getAnnotationViewClassname = (isUnresolved, hasFocus, isHovered) => {
|
|
29
3
|
if (!isUnresolved) {
|
|
30
4
|
return;
|
|
@@ -4,7 +4,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
4
4
|
import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
6
|
import { clearDirtyMark, closeComponent, setHoveredAnnotation, setInlineCommentsVisibility, setSelectedAnnotation, updateInlineCommentResolvedState, updateMouseState } from '../editor-commands';
|
|
7
|
-
import {
|
|
7
|
+
import { getAnnotationViewClassname, getBlockAnnotationViewClassname } from '../nodeviews';
|
|
8
8
|
import { createPluginState } from './plugin-factory';
|
|
9
9
|
import { decorationKey, getAllAnnotations, getPluginState, inlineCommentPluginKey } from './utils';
|
|
10
10
|
const fetchProviderStates = async (provider, annotationIds) => {
|
|
@@ -95,8 +95,6 @@ const onSetVisibility = view => isVisible => {
|
|
|
95
95
|
export const inlineCommentPlugin = options => {
|
|
96
96
|
const {
|
|
97
97
|
provider,
|
|
98
|
-
portalProviderAPI,
|
|
99
|
-
eventDispatcher,
|
|
100
98
|
featureFlagsPluginState
|
|
101
99
|
} = options;
|
|
102
100
|
return new SafePlugin({
|
|
@@ -157,12 +155,6 @@ export const inlineCommentPlugin = options => {
|
|
|
157
155
|
};
|
|
158
156
|
},
|
|
159
157
|
props: {
|
|
160
|
-
...(!fg('platform_editor_annotation_react_18_mem_leak') && {
|
|
161
|
-
nodeViews: {
|
|
162
|
-
annotation: (node, view, getPos) => new AnnotationNodeView(node, view, getPos, portalProviderAPI, eventDispatcher) // resolved
|
|
163
|
-
.init()
|
|
164
|
-
}
|
|
165
|
-
}),
|
|
166
158
|
handleDOMEvents: {
|
|
167
159
|
mousedown: view => {
|
|
168
160
|
const pluginState = getPluginState(view.state);
|
|
@@ -12,7 +12,7 @@ export let AnnotationSelectionType = /*#__PURE__*/function (AnnotationSelectionT
|
|
|
12
12
|
AnnotationSelectionType["DISABLED"] = "disabled";
|
|
13
13
|
AnnotationSelectionType["VALID"] = "valid";
|
|
14
14
|
return AnnotationSelectionType;
|
|
15
|
-
}({});
|
|
15
|
+
}({});
|
|
16
16
|
const prefix = 'ak-editor-annotation';
|
|
17
17
|
export const AnnotationTestIds = {
|
|
18
18
|
prefix,
|
|
@@ -2,9 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
4
|
import React from 'react';
|
|
5
|
-
import { annotation } from '@atlaskit/adf-schema';
|
|
6
5
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
7
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
6
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
9
7
|
import { setInlineCommentDraftState, showInlineCommentForBlockNode } from './editor-commands';
|
|
10
8
|
import { annotationWithToDOMFix } from './nodeviews/annotationMark';
|
|
@@ -23,7 +21,7 @@ export var annotationPlugin = function annotationPlugin(_ref) {
|
|
|
23
21
|
marks: function marks() {
|
|
24
22
|
return [{
|
|
25
23
|
name: 'annotation',
|
|
26
|
-
mark:
|
|
24
|
+
mark: annotationWithToDOMFix
|
|
27
25
|
}];
|
|
28
26
|
},
|
|
29
27
|
actions: {
|
|
@@ -44,15 +42,11 @@ export var annotationPlugin = function annotationPlugin(_ref) {
|
|
|
44
42
|
return [{
|
|
45
43
|
name: 'annotation',
|
|
46
44
|
plugin: function plugin(_ref2) {
|
|
47
|
-
var dispatch = _ref2.dispatch
|
|
48
|
-
portalProviderAPI = _ref2.portalProviderAPI,
|
|
49
|
-
eventDispatcher = _ref2.eventDispatcher;
|
|
45
|
+
var dispatch = _ref2.dispatch;
|
|
50
46
|
if (annotationProviders) {
|
|
51
47
|
var _api$analytics2;
|
|
52
48
|
return inlineCommentPlugin({
|
|
53
49
|
dispatch: dispatch,
|
|
54
|
-
portalProviderAPI: portalProviderAPI,
|
|
55
|
-
eventDispatcher: eventDispatcher,
|
|
56
50
|
provider: annotationProviders.inlineComment,
|
|
57
51
|
editorAnalyticsAPI: api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions,
|
|
58
52
|
featureFlagsPluginState: featureFlags
|
|
@@ -1,49 +1,4 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
4
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
5
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
|
-
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
7
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
8
|
-
import React from 'react';
|
|
9
|
-
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
10
1
|
import { AnnotationSharedClassNames, BlockAnnotationSharedClassNames } from '@atlaskit/editor-common/styles';
|
|
11
|
-
export var AnnotationNodeView = /*#__PURE__*/function (_ReactNodeView) {
|
|
12
|
-
function AnnotationNodeView() {
|
|
13
|
-
_classCallCheck(this, AnnotationNodeView);
|
|
14
|
-
return _callSuper(this, AnnotationNodeView, arguments);
|
|
15
|
-
}
|
|
16
|
-
_inherits(AnnotationNodeView, _ReactNodeView);
|
|
17
|
-
return _createClass(AnnotationNodeView, [{
|
|
18
|
-
key: "createDomRef",
|
|
19
|
-
value: function createDomRef() {
|
|
20
|
-
return document.createElement('span');
|
|
21
|
-
}
|
|
22
|
-
}, {
|
|
23
|
-
key: "getContentDOM",
|
|
24
|
-
value: function getContentDOM() {
|
|
25
|
-
var dom = document.createElement('span');
|
|
26
|
-
dom.className = 'ak-editor-annotation';
|
|
27
|
-
return {
|
|
28
|
-
dom: dom
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
}, {
|
|
32
|
-
key: "render",
|
|
33
|
-
value: function render(_props, forwardRef) {
|
|
34
|
-
return (
|
|
35
|
-
/*#__PURE__*/
|
|
36
|
-
// all inline comment states are now set in decorations at ../pm-plugins/inline-comment.ts
|
|
37
|
-
React.createElement("span", {
|
|
38
|
-
"data-mark-type": "annotation",
|
|
39
|
-
"data-id": this.node.attrs.id,
|
|
40
|
-
"data-mark-annotation-type": this.node.attrs.annotationType,
|
|
41
|
-
ref: forwardRef
|
|
42
|
-
})
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
}]);
|
|
46
|
-
}(ReactNodeView);
|
|
47
2
|
export var getAnnotationViewClassname = function getAnnotationViewClassname(isUnresolved, hasFocus, isHovered) {
|
|
48
3
|
if (!isUnresolved) {
|
|
49
4
|
return;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
3
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
6
4
|
import { AnnotationTypes } from '@atlaskit/adf-schema';
|
|
7
5
|
import { RESOLVE_METHOD } from '@atlaskit/editor-common/analytics';
|
|
@@ -9,7 +7,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
9
7
|
import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
10
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
9
|
import { clearDirtyMark, closeComponent, setHoveredAnnotation, setInlineCommentsVisibility, setSelectedAnnotation, updateInlineCommentResolvedState, updateMouseState } from '../editor-commands';
|
|
12
|
-
import {
|
|
10
|
+
import { getAnnotationViewClassname, getBlockAnnotationViewClassname } from '../nodeviews';
|
|
13
11
|
import { createPluginState } from './plugin-factory';
|
|
14
12
|
import { decorationKey, getAllAnnotations, getPluginState, inlineCommentPluginKey } from './utils';
|
|
15
13
|
var fetchProviderStates = /*#__PURE__*/function () {
|
|
@@ -151,8 +149,6 @@ var onSetVisibility = function onSetVisibility(view) {
|
|
|
151
149
|
};
|
|
152
150
|
export var inlineCommentPlugin = function inlineCommentPlugin(options) {
|
|
153
151
|
var provider = options.provider,
|
|
154
|
-
portalProviderAPI = options.portalProviderAPI,
|
|
155
|
-
eventDispatcher = options.eventDispatcher,
|
|
156
152
|
featureFlagsPluginState = options.featureFlagsPluginState;
|
|
157
153
|
return new SafePlugin({
|
|
158
154
|
key: inlineCommentPluginKey,
|
|
@@ -216,14 +212,7 @@ export var inlineCommentPlugin = function inlineCommentPlugin(options) {
|
|
|
216
212
|
}
|
|
217
213
|
};
|
|
218
214
|
},
|
|
219
|
-
props:
|
|
220
|
-
nodeViews: {
|
|
221
|
-
annotation: function annotation(node, view, getPos) {
|
|
222
|
-
return new AnnotationNodeView(node, view, getPos, portalProviderAPI, eventDispatcher) // resolved
|
|
223
|
-
.init();
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
}), {}, {
|
|
215
|
+
props: {
|
|
227
216
|
handleDOMEvents: {
|
|
228
217
|
mousedown: function mousedown(view) {
|
|
229
218
|
var pluginState = getPluginState(view.state);
|
|
@@ -301,6 +290,6 @@ export var inlineCommentPlugin = function inlineCommentPlugin(options) {
|
|
|
301
290
|
decorations = decorations.add(state.doc, focusDecorations);
|
|
302
291
|
return decorations;
|
|
303
292
|
}
|
|
304
|
-
}
|
|
293
|
+
}
|
|
305
294
|
});
|
|
306
295
|
};
|
package/dist/esm/types/index.js
CHANGED
|
@@ -12,7 +12,7 @@ export var AnnotationSelectionType = /*#__PURE__*/function (AnnotationSelectionT
|
|
|
12
12
|
AnnotationSelectionType["DISABLED"] = "disabled";
|
|
13
13
|
AnnotationSelectionType["VALID"] = "valid";
|
|
14
14
|
return AnnotationSelectionType;
|
|
15
|
-
}({});
|
|
15
|
+
}({});
|
|
16
16
|
var prefix = 'ak-editor-annotation';
|
|
17
17
|
export var AnnotationTestIds = {
|
|
18
18
|
prefix: prefix,
|
|
@@ -1,12 +1,2 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { ForwardRef } from '@atlaskit/editor-common/react-node-view';
|
|
3
|
-
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
4
|
-
export declare class AnnotationNodeView extends ReactNodeView {
|
|
5
|
-
createDomRef(): HTMLSpanElement;
|
|
6
|
-
getContentDOM(): {
|
|
7
|
-
dom: HTMLSpanElement;
|
|
8
|
-
};
|
|
9
|
-
render(_props: Object, forwardRef: ForwardRef): React.JSX.Element;
|
|
10
|
-
}
|
|
11
1
|
export declare const getAnnotationViewClassname: (isUnresolved: boolean, hasFocus: boolean, isHovered: boolean) => string | undefined;
|
|
12
2
|
export declare const getBlockAnnotationViewClassname: (isUnresolved: boolean, hasFocus: boolean) => string | undefined;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI, VIEW_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import type { Dispatch
|
|
3
|
-
import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
|
|
2
|
+
import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
4
3
|
import type { FeatureFlags } from '@atlaskit/editor-common/types';
|
|
5
4
|
import type { EditorState, SelectionBookmark } from '@atlaskit/editor-prosemirror/state';
|
|
6
5
|
import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
@@ -18,8 +17,6 @@ export declare enum ACTIONS {
|
|
|
18
17
|
}
|
|
19
18
|
export interface InlineCommentPluginOptions {
|
|
20
19
|
dispatch: Dispatch;
|
|
21
|
-
eventDispatcher: EventDispatcher;
|
|
22
|
-
portalProviderAPI: PortalProviderAPI;
|
|
23
20
|
provider: InlineCommentAnnotationProvider;
|
|
24
21
|
editorAnalyticsAPI: EditorAnalyticsAPI | undefined;
|
|
25
22
|
featureFlagsPluginState?: FeatureFlags;
|
|
@@ -1,12 +1,2 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { ForwardRef } from '@atlaskit/editor-common/react-node-view';
|
|
3
|
-
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
4
|
-
export declare class AnnotationNodeView extends ReactNodeView {
|
|
5
|
-
createDomRef(): HTMLSpanElement;
|
|
6
|
-
getContentDOM(): {
|
|
7
|
-
dom: HTMLSpanElement;
|
|
8
|
-
};
|
|
9
|
-
render(_props: Object, forwardRef: ForwardRef): React.JSX.Element;
|
|
10
|
-
}
|
|
11
1
|
export declare const getAnnotationViewClassname: (isUnresolved: boolean, hasFocus: boolean, isHovered: boolean) => string | undefined;
|
|
12
2
|
export declare const getBlockAnnotationViewClassname: (isUnresolved: boolean, hasFocus: boolean) => string | undefined;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI, VIEW_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import type { Dispatch
|
|
3
|
-
import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
|
|
2
|
+
import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
4
3
|
import type { FeatureFlags } from '@atlaskit/editor-common/types';
|
|
5
4
|
import type { EditorState, SelectionBookmark } from '@atlaskit/editor-prosemirror/state';
|
|
6
5
|
import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
@@ -18,8 +17,6 @@ export declare enum ACTIONS {
|
|
|
18
17
|
}
|
|
19
18
|
export interface InlineCommentPluginOptions {
|
|
20
19
|
dispatch: Dispatch;
|
|
21
|
-
eventDispatcher: EventDispatcher;
|
|
22
|
-
portalProviderAPI: PortalProviderAPI;
|
|
23
20
|
provider: InlineCommentAnnotationProvider;
|
|
24
21
|
editorAnalyticsAPI: EditorAnalyticsAPI | undefined;
|
|
25
22
|
featureFlagsPluginState?: FeatureFlags;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-annotation",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "Annotation plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,21 +32,21 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/adf-schema": "^47.2.1",
|
|
35
|
-
"@atlaskit/editor-common": "^
|
|
36
|
-
"@atlaskit/editor-plugin-analytics": "^
|
|
37
|
-
"@atlaskit/editor-plugin-connectivity": "^
|
|
38
|
-
"@atlaskit/editor-plugin-editor-viewmode-effects": "^
|
|
35
|
+
"@atlaskit/editor-common": "^100.1.0",
|
|
36
|
+
"@atlaskit/editor-plugin-analytics": "^2.0.0",
|
|
37
|
+
"@atlaskit/editor-plugin-connectivity": "^2.0.0",
|
|
38
|
+
"@atlaskit/editor-plugin-editor-viewmode-effects": "^2.0.0",
|
|
39
39
|
"@atlaskit/editor-plugin-feature-flags": "^1.3.0",
|
|
40
40
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
41
|
-
"@atlaskit/icon": "^
|
|
42
|
-
"@atlaskit/onboarding": "^
|
|
43
|
-
"@atlaskit/platform-feature-flags": "^1.
|
|
44
|
-
"@atlaskit/tmp-editor-statsig": "^2.
|
|
41
|
+
"@atlaskit/icon": "^24.1.0",
|
|
42
|
+
"@atlaskit/onboarding": "^13.0.0",
|
|
43
|
+
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
44
|
+
"@atlaskit/tmp-editor-statsig": "^3.2.0",
|
|
45
45
|
"@babel/runtime": "^7.0.0"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"react": "^
|
|
49
|
-
"react-dom": "^
|
|
48
|
+
"react": "^18.2.0",
|
|
49
|
+
"react-dom": "^18.2.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@af/integration-testing": "*",
|
|
@@ -96,9 +96,6 @@
|
|
|
96
96
|
"editor_inline_comments_on_inline_nodes": {
|
|
97
97
|
"type": "boolean"
|
|
98
98
|
},
|
|
99
|
-
"platform_editor_annotation_react_18_mem_leak": {
|
|
100
|
-
"type": "boolean"
|
|
101
|
-
},
|
|
102
99
|
"platform_inline_node_as_valid_annotation_selection": {
|
|
103
100
|
"type": "boolean"
|
|
104
101
|
},
|