@atlaskit/editor-plugin-annotation 26.0.3 → 26.0.5
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 +12 -0
- package/dist/cjs/annotationPlugin.js +4 -4
- package/dist/cjs/editor-commands/index.js +4 -3
- package/dist/cjs/editor-commands/transform.js +32 -32
- package/dist/cjs/nodeviews/index.js +5 -5
- package/dist/cjs/pm-plugins/annotation-manager-hooks.js +21 -21
- package/dist/cjs/pm-plugins/inline-comment.js +27 -27
- package/dist/cjs/pm-plugins/keymap.js +2 -2
- package/dist/cjs/pm-plugins/plugin-factory.js +9 -9
- package/dist/cjs/pm-plugins/toolbar.js +35 -33
- package/dist/cjs/pm-plugins/utils.js +17 -16
- package/dist/cjs/ui/CommentButton/CommentButton.js +17 -16
- package/dist/cjs/ui/CommentButton/hooks.js +6 -6
- package/dist/cjs/ui/CommentButton/utils.js +18 -17
- package/dist/cjs/ui/InlineCommentView.js +26 -25
- package/dist/cjs/ui/toolbar-components.js +16 -15
- package/dist/es2019/annotationPlugin.js +2 -2
- package/dist/es2019/editor-commands/index.js +2 -1
- package/dist/es2019/editor-commands/transform.js +3 -3
- package/dist/es2019/nodeviews/index.js +1 -1
- package/dist/es2019/pm-plugins/annotation-manager-hooks.js +1 -1
- package/dist/es2019/pm-plugins/inline-comment.js +2 -2
- package/dist/es2019/pm-plugins/keymap.js +1 -1
- package/dist/es2019/pm-plugins/plugin-factory.js +1 -1
- package/dist/es2019/pm-plugins/toolbar.js +6 -4
- package/dist/es2019/pm-plugins/utils.js +4 -3
- package/dist/es2019/ui/CommentButton/CommentButton.js +7 -6
- package/dist/es2019/ui/CommentButton/hooks.js +1 -1
- package/dist/es2019/ui/CommentButton/utils.js +3 -2
- package/dist/es2019/ui/InlineCommentView.js +6 -5
- package/dist/es2019/ui/toolbar-components.js +2 -1
- package/dist/esm/annotationPlugin.js +2 -2
- package/dist/esm/editor-commands/index.js +2 -1
- package/dist/esm/editor-commands/transform.js +3 -3
- package/dist/esm/nodeviews/index.js +1 -1
- package/dist/esm/pm-plugins/annotation-manager-hooks.js +1 -1
- package/dist/esm/pm-plugins/inline-comment.js +2 -2
- package/dist/esm/pm-plugins/keymap.js +1 -1
- package/dist/esm/pm-plugins/plugin-factory.js +1 -1
- package/dist/esm/pm-plugins/toolbar.js +6 -4
- package/dist/esm/pm-plugins/utils.js +4 -3
- package/dist/esm/ui/CommentButton/CommentButton.js +7 -6
- package/dist/esm/ui/CommentButton/hooks.js +1 -1
- package/dist/esm/ui/CommentButton/utils.js +3 -2
- package/dist/esm/ui/InlineCommentView.js +6 -5
- package/dist/esm/ui/toolbar-components.js +2 -1
- package/dist/types/annotationPluginType.d.ts +9 -8
- package/dist/types/editor-commands/index.d.ts +4 -3
- package/dist/types/editor-commands/transform.d.ts +3 -2
- package/dist/types/editor-commands/utils.d.ts +1 -1
- package/dist/types/pm-plugins/keymap.d.ts +1 -1
- package/dist/types/pm-plugins/plugin-factory.d.ts +1 -1
- package/dist/types/pm-plugins/toolbar.d.ts +5 -3
- package/dist/types/pm-plugins/types.d.ts +3 -2
- package/dist/types/pm-plugins/utils.d.ts +1 -1
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types/ui/CommentButton/CommentButton.d.ts +1 -1
- package/dist/types/ui/CommentButton/hooks.d.ts +1 -1
- package/dist/types/ui/CommentButton/utils.d.ts +1 -1
- package/dist/types/ui/InlineCommentView.d.ts +3 -2
- package/dist/types/ui/toolbar-components.d.ts +2 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -10,8 +10,8 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
10
10
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
11
|
var _react = _interopRequireDefault(require("react"));
|
|
12
12
|
var _annotation = require("@atlaskit/adf-schema/annotation");
|
|
13
|
-
var
|
|
14
|
-
var
|
|
13
|
+
var _isSsr = require("@atlaskit/editor-common/is-ssr");
|
|
14
|
+
var _useSharedPluginStateWithSelector = require("@atlaskit/editor-common/useSharedPluginStateWithSelector");
|
|
15
15
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
16
16
|
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
17
17
|
var _editorCommands = require("./editor-commands");
|
|
@@ -202,7 +202,7 @@ var annotationPlugin = exports.annotationPlugin = function annotationPlugin(_ref
|
|
|
202
202
|
contentComponent: function contentComponent(_ref5) {
|
|
203
203
|
var editorView = _ref5.editorView,
|
|
204
204
|
dispatchAnalyticsEvent = _ref5.dispatchAnalyticsEvent;
|
|
205
|
-
if (!annotationProviders || !editorView || (0,
|
|
205
|
+
if (!annotationProviders || !editorView || (0, _isSsr.isSSR)()) {
|
|
206
206
|
return null;
|
|
207
207
|
}
|
|
208
208
|
return /*#__PURE__*/_react.default.createElement(AnnotationContentComponent, {
|
|
@@ -228,7 +228,7 @@ function AnnotationContentComponent(_ref6) {
|
|
|
228
228
|
editorView = _ref6.editorView,
|
|
229
229
|
annotationProviders = _ref6.annotationProviders,
|
|
230
230
|
dispatchAnalyticsEvent = _ref6.dispatchAnalyticsEvent;
|
|
231
|
-
var annotationState = (0,
|
|
231
|
+
var annotationState = (0, _useSharedPluginStateWithSelector.useSharedPluginStateWithSelector)(api, ['annotation'], selector);
|
|
232
232
|
|
|
233
233
|
// need to explicitly check for false as undefined is also a valid value to continue
|
|
234
234
|
if ((annotationState === null || annotationState === void 0 ? void 0 : annotationState.isVisible) === false) {
|
|
@@ -7,7 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.updateMouseState = exports.updateInlineCommentResolvedState = exports.showInlineCommentForBlockNode = exports.setSelectedAnnotation = exports.setPendingSelectedAnnotation = exports.setInlineCommentsVisibility = exports.setInlineCommentsFetched = exports.setInlineCommentDraftState = exports.setHoveredAnnotation = exports.removeInlineCommentNearSelection = exports.removeInlineCommentFromDoc = exports.flushPendingSelections = exports.createAnnotation = exports.closeComponent = exports.clearDirtyMark = exports.addInlineComment = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _annotation = require("@atlaskit/adf-schema/annotation");
|
|
10
|
-
var
|
|
10
|
+
var _enums = require("@atlaskit/editor-common/analytics/types/enums");
|
|
11
|
+
var _inlineCommentEvents = require("@atlaskit/editor-common/analytics/types/inline-comment-events");
|
|
11
12
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
12
13
|
var _pluginFactory = require("../pm-plugins/plugin-factory");
|
|
13
14
|
var _types = require("../pm-plugins/types");
|
|
@@ -34,7 +35,7 @@ var updateInlineCommentResolvedState = exports.updateInlineCommentResolvedState
|
|
|
34
35
|
// To quickly fix this problem to unblock live pages this will just stop the transaction causing a scroll when the
|
|
35
36
|
// resolve method is set.
|
|
36
37
|
var transformer = function transformer(tr, state) {
|
|
37
|
-
return resolveMethod ===
|
|
38
|
+
return resolveMethod === _inlineCommentEvents.RESOLVE_METHOD.CONSUMER ? tr.setMeta('scrollIntoView', false) : tr;
|
|
38
39
|
};
|
|
39
40
|
if (resolveMethod && allResolved) {
|
|
40
41
|
return (0, _pluginFactory.createCommand)(command, function (tr, state) {
|
|
@@ -250,7 +251,7 @@ var setInlineCommentDraftState = exports.setInlineCommentDraftState = function s
|
|
|
250
251
|
var api = arguments.length > 2 ? arguments[2] : undefined;
|
|
251
252
|
var isBlockNodeSupported = arguments.length > 3 ? arguments[3] : undefined;
|
|
252
253
|
return function (drafting) {
|
|
253
|
-
var inputMethod = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] :
|
|
254
|
+
var inputMethod = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _enums.INPUT_METHOD.TOOLBAR;
|
|
254
255
|
var targetType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'inline';
|
|
255
256
|
var targetNodeId = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : undefined;
|
|
256
257
|
var isOpeningMediaCommentFromToolbar = arguments.length > 4 ? arguments[4] : undefined;
|
|
@@ -5,26 +5,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _annotation = require("@atlaskit/adf-schema/annotation");
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
8
|
+
var _enums = require("@atlaskit/editor-common/analytics/types/enums");
|
|
9
|
+
var _commands = require("@atlaskit/editor-common/mark/commands");
|
|
10
|
+
var _annotation2 = require("@atlaskit/editor-common/utils/annotation");
|
|
11
11
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
12
12
|
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
13
13
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
14
|
-
var
|
|
14
|
+
var _utils = require("../pm-plugins/utils");
|
|
15
15
|
var isAnnotationStep = function isAnnotationStep(step) {
|
|
16
16
|
return step instanceof _transform.AddMarkStep && step.mark.type.name === 'annotation';
|
|
17
17
|
};
|
|
18
18
|
var addAnnotationMark = function addAnnotationMark(id, supportedBlockNodes, isBlockNodeSupported) {
|
|
19
19
|
return function (transaction, state) {
|
|
20
|
-
var inlineCommentState = (0,
|
|
20
|
+
var inlineCommentState = (0, _utils.getPluginState)(state);
|
|
21
21
|
var _ref = inlineCommentState || {},
|
|
22
22
|
bookmark = _ref.bookmark;
|
|
23
23
|
var annotationMark = state.schema.marks.annotation.create({
|
|
24
24
|
id: id,
|
|
25
25
|
type: _annotation.AnnotationTypes.INLINE_COMMENT
|
|
26
26
|
});
|
|
27
|
-
var _resolveDraftBookmark = (0,
|
|
27
|
+
var _resolveDraftBookmark = (0, _utils.resolveDraftBookmark)(state, bookmark, supportedBlockNodes, isBlockNodeSupported),
|
|
28
28
|
from = _resolveDraftBookmark.from,
|
|
29
29
|
to = _resolveDraftBookmark.to,
|
|
30
30
|
head = _resolveDraftBookmark.head,
|
|
@@ -36,7 +36,7 @@ var addAnnotationMark = function addAnnotationMark(id, supportedBlockNodes, isBl
|
|
|
36
36
|
tr.setSelection(_state.NodeSelection.create(tr.doc, from));
|
|
37
37
|
} else {
|
|
38
38
|
// Apply the mark only to text node in the range.
|
|
39
|
-
var _tr = (0,
|
|
39
|
+
var _tr = (0, _commands.applyMarkOnRange)(from, to, false, annotationMark, transaction);
|
|
40
40
|
|
|
41
41
|
// The mark may not be applied to the current "head" of the bookmark so determine what was applied
|
|
42
42
|
// above and use that instead
|
|
@@ -57,8 +57,8 @@ var addInlineComment = function addInlineComment(editorAnalyticsAPI, editorAPI)
|
|
|
57
57
|
// add insert analytics step to transaction
|
|
58
58
|
tr = addInsertAnalytics(editorAnalyticsAPI)(tr, state);
|
|
59
59
|
// add close analytics step to transaction
|
|
60
|
-
tr = addOpenCloseAnalytics(editorAnalyticsAPI)(false,
|
|
61
|
-
var pluginState = (0,
|
|
60
|
+
tr = addOpenCloseAnalytics(editorAnalyticsAPI)(false, _enums.INPUT_METHOD.TOOLBAR)(tr, state);
|
|
61
|
+
var pluginState = (0, _utils.getPluginState)(state);
|
|
62
62
|
var isAutoScrollBugFixEnabled = pluginState === null || pluginState === void 0 || (_pluginState$featureF = pluginState.featureFlagsPluginState) === null || _pluginState$featureF === void 0 ? void 0 : _pluginState$featureF.commentsOnMediaAutoscrollInEditor;
|
|
63
63
|
if (isAutoScrollBugFixEnabled) {
|
|
64
64
|
// Explicitly disable scrollIntoView as scrolling is handled by CommentSidebar
|
|
@@ -70,9 +70,9 @@ var addInlineComment = function addInlineComment(editorAnalyticsAPI, editorAPI)
|
|
|
70
70
|
};
|
|
71
71
|
var addOpenCloseAnalytics = function addOpenCloseAnalytics(editorAnalyticsAPI) {
|
|
72
72
|
return function (drafting) {
|
|
73
|
-
var method = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] :
|
|
73
|
+
var method = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _enums.INPUT_METHOD.TOOLBAR;
|
|
74
74
|
return function (transaction, state) {
|
|
75
|
-
var draftingPayload = (0,
|
|
75
|
+
var draftingPayload = (0, _utils.getDraftCommandAnalyticsPayload)(drafting, method)(state);
|
|
76
76
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(draftingPayload)(transaction);
|
|
77
77
|
return transaction;
|
|
78
78
|
};
|
|
@@ -80,11 +80,11 @@ var addOpenCloseAnalytics = function addOpenCloseAnalytics(editorAnalyticsAPI) {
|
|
|
80
80
|
};
|
|
81
81
|
var handleDraftState = function handleDraftState(editorAnalyticsAPI) {
|
|
82
82
|
return function (drafting) {
|
|
83
|
-
var method = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] :
|
|
83
|
+
var method = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _enums.INPUT_METHOD.TOOLBAR;
|
|
84
84
|
return function (transaction, state) {
|
|
85
85
|
var _pluginState$featureF2;
|
|
86
86
|
var tr = addOpenCloseAnalytics(editorAnalyticsAPI)(drafting, method)(transaction, state);
|
|
87
|
-
var pluginState = (0,
|
|
87
|
+
var pluginState = (0, _utils.getPluginState)(state);
|
|
88
88
|
var isAutoScrollBugFixEnabled = pluginState === null || pluginState === void 0 || (_pluginState$featureF2 = pluginState.featureFlagsPluginState) === null || _pluginState$featureF2 === void 0 ? void 0 : _pluginState$featureF2.commentsOnMediaAutoscrollInEditor;
|
|
89
89
|
if (isAutoScrollBugFixEnabled) {
|
|
90
90
|
// Explicitly disable scrollIntoView as scrolling is handled by CommentSidebar
|
|
@@ -97,22 +97,22 @@ var handleDraftState = function handleDraftState(editorAnalyticsAPI) {
|
|
|
97
97
|
var addInsertAnalytics = function addInsertAnalytics(editorAnalyticsAPI) {
|
|
98
98
|
return function (transaction, state) {
|
|
99
99
|
var analyticsEvent = {
|
|
100
|
-
action:
|
|
101
|
-
actionSubject:
|
|
102
|
-
eventType:
|
|
103
|
-
actionSubjectId:
|
|
100
|
+
action: _enums.ACTION.INSERTED,
|
|
101
|
+
actionSubject: _enums.ACTION_SUBJECT.ANNOTATION,
|
|
102
|
+
eventType: _enums.EVENT_TYPE.TRACK,
|
|
103
|
+
actionSubjectId: _enums.ACTION_SUBJECT_ID.INLINE_COMMENT,
|
|
104
104
|
attributes: {}
|
|
105
105
|
};
|
|
106
106
|
if ((0, _fg.fg)('editor_inline_comments_on_inline_nodes')) {
|
|
107
|
-
var _ref2 = (0,
|
|
107
|
+
var _ref2 = (0, _utils.getPluginState)(state) || {},
|
|
108
108
|
bookmark = _ref2.bookmark;
|
|
109
109
|
|
|
110
110
|
// When this FF is removed we can move the analytics event creation inside of the
|
|
111
111
|
// attachAnalyticsEvent and get type inference for the attributes.
|
|
112
112
|
// @ts-ignore
|
|
113
|
-
analyticsEvent.attributes.inlineNodeNames = (0,
|
|
113
|
+
analyticsEvent.attributes.inlineNodeNames = (0, _annotation2.getRangeInlineNodeNames)({
|
|
114
114
|
doc: state.doc,
|
|
115
|
-
pos: (0,
|
|
115
|
+
pos: (0, _utils.resolveDraftBookmark)(state, bookmark)
|
|
116
116
|
});
|
|
117
117
|
}
|
|
118
118
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(analyticsEvent)(transaction);
|
|
@@ -123,10 +123,10 @@ var addResolveAnalytics = function addResolveAnalytics(editorAnalyticsAPI) {
|
|
|
123
123
|
return function (method) {
|
|
124
124
|
return function (transaction, state) {
|
|
125
125
|
var resolvedPayload = {
|
|
126
|
-
action:
|
|
127
|
-
actionSubject:
|
|
128
|
-
actionSubjectId:
|
|
129
|
-
eventType:
|
|
126
|
+
action: _enums.ACTION.RESOLVED,
|
|
127
|
+
actionSubject: _enums.ACTION_SUBJECT.ANNOTATION,
|
|
128
|
+
actionSubjectId: _enums.ACTION_SUBJECT_ID.INLINE_COMMENT,
|
|
129
|
+
eventType: _enums.EVENT_TYPE.TRACK,
|
|
130
130
|
attributes: {
|
|
131
131
|
method: method
|
|
132
132
|
}
|
|
@@ -140,10 +140,10 @@ var addPreemptiveGateErrorAnalytics = function addPreemptiveGateErrorAnalytics(e
|
|
|
140
140
|
return function (errorReason) {
|
|
141
141
|
return function (transaction, state) {
|
|
142
142
|
var analyticsEvent = {
|
|
143
|
-
action:
|
|
144
|
-
actionSubject:
|
|
145
|
-
actionSubjectId:
|
|
146
|
-
eventType:
|
|
143
|
+
action: _enums.ACTION.ERROR,
|
|
144
|
+
actionSubject: _enums.ACTION_SUBJECT.ANNOTATION,
|
|
145
|
+
actionSubjectId: _enums.ACTION_SUBJECT_ID.INLINE_COMMENT,
|
|
146
|
+
eventType: _enums.EVENT_TYPE.OPERATIONAL,
|
|
147
147
|
attributes: {
|
|
148
148
|
errorReason: errorReason
|
|
149
149
|
}
|
|
@@ -156,10 +156,10 @@ var addPreemptiveGateErrorAnalytics = function addPreemptiveGateErrorAnalytics(e
|
|
|
156
156
|
var addDeleteAnalytics = function addDeleteAnalytics(editorAnalyticsAPI) {
|
|
157
157
|
return function (transaction, state) {
|
|
158
158
|
var analyticsEvent = {
|
|
159
|
-
action:
|
|
160
|
-
actionSubject:
|
|
161
|
-
actionSubjectId:
|
|
162
|
-
eventType:
|
|
159
|
+
action: _enums.ACTION.DELETED,
|
|
160
|
+
actionSubject: _enums.ACTION_SUBJECT.ANNOTATION,
|
|
161
|
+
actionSubjectId: _enums.ACTION_SUBJECT_ID.INLINE_COMMENT,
|
|
162
|
+
eventType: _enums.EVENT_TYPE.TRACK,
|
|
163
163
|
attributes: {}
|
|
164
164
|
};
|
|
165
165
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(analyticsEvent)(transaction);
|
|
@@ -4,22 +4,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getBlockAnnotationViewClassname = exports.getAnnotationViewClassname = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _annotation = require("@atlaskit/editor-common/styles/annotation");
|
|
8
8
|
var getAnnotationViewClassname = exports.getAnnotationViewClassname = function getAnnotationViewClassname(isUnresolved, hasFocus, isHovered) {
|
|
9
9
|
if (!isUnresolved) {
|
|
10
10
|
return;
|
|
11
11
|
}
|
|
12
12
|
if (hasFocus) {
|
|
13
|
-
return
|
|
13
|
+
return _annotation.AnnotationSharedClassNames.focus;
|
|
14
14
|
}
|
|
15
15
|
if (isHovered) {
|
|
16
|
-
return
|
|
16
|
+
return _annotation.AnnotationSharedClassNames.hover;
|
|
17
17
|
}
|
|
18
|
-
return
|
|
18
|
+
return _annotation.AnnotationSharedClassNames.blur;
|
|
19
19
|
};
|
|
20
20
|
var getBlockAnnotationViewClassname = exports.getBlockAnnotationViewClassname = function getBlockAnnotationViewClassname(isUnresolved, hasFocus) {
|
|
21
21
|
if (!isUnresolved) {
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
|
-
return hasFocus ?
|
|
24
|
+
return hasFocus ? _annotation.BlockAnnotationSharedClassNames.focus : _annotation.BlockAnnotationSharedClassNames.blur;
|
|
25
25
|
};
|
|
@@ -5,11 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.startDraft = exports.setIsAnnotationSelected = exports.setIsAnnotationHovered = exports.getDraft = exports.clearDraft = exports.clearAnnotation = exports.applyDraft = exports.allowAnnotation = void 0;
|
|
7
7
|
var _annotation = require("@atlaskit/adf-schema/annotation");
|
|
8
|
-
var
|
|
9
|
-
var
|
|
8
|
+
var _annotation2 = require("@atlaskit/editor-common/utils/annotation");
|
|
9
|
+
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
10
10
|
var _editorCommands = require("../editor-commands");
|
|
11
11
|
var _types = require("../types");
|
|
12
|
-
var
|
|
12
|
+
var _utils2 = require("./utils");
|
|
13
13
|
var ERROR_REASON_DRAFT_NOT_STARTED = 'draft-not-started';
|
|
14
14
|
var ERROR_REASON_DRAFT_IN_PROGRESS = 'draft-in-progress';
|
|
15
15
|
var ERROR_REASON_RANGE_MISSING = 'range-no-longer-exists';
|
|
@@ -20,7 +20,7 @@ var domRefFromPos = function domRefFromPos(view, position) {
|
|
|
20
20
|
try {
|
|
21
21
|
// Ignored via go/ees005
|
|
22
22
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
23
|
-
dom = (0,
|
|
23
|
+
dom = (0, _utils.findDomRefAtPos)(position, view.domAtPos.bind(view));
|
|
24
24
|
} catch (error) {
|
|
25
25
|
// eslint-disable-next-line no-console
|
|
26
26
|
console.warn(error);
|
|
@@ -30,7 +30,7 @@ var domRefFromPos = function domRefFromPos(view, position) {
|
|
|
30
30
|
};
|
|
31
31
|
var allowAnnotation = exports.allowAnnotation = function allowAnnotation(editorView, options) {
|
|
32
32
|
return function () {
|
|
33
|
-
var _ref =
|
|
33
|
+
var _ref = _utils2.inlineCommentPluginKey.getState(editorView.state) || {},
|
|
34
34
|
isDrafting = _ref.isDrafting,
|
|
35
35
|
draftDecorationSet = _ref.draftDecorationSet;
|
|
36
36
|
if (isDrafting) {
|
|
@@ -42,13 +42,13 @@ var allowAnnotation = exports.allowAnnotation = function allowAnnotation(editorV
|
|
|
42
42
|
if (!!(decoration !== null && decoration !== void 0 && decoration.length)) {
|
|
43
43
|
return false;
|
|
44
44
|
}
|
|
45
|
-
return (0,
|
|
45
|
+
return (0, _utils2.isSelectionValid)(editorView.state, options.provider.supportedBlockNodes, options.provider.isBlockNodeSupported) === _types.AnnotationSelectionType.VALID;
|
|
46
46
|
};
|
|
47
47
|
};
|
|
48
48
|
var startDraft = exports.startDraft = function startDraft(editorView, options) {
|
|
49
49
|
return function () {
|
|
50
50
|
var _getRangeInlineNodeNa, _options$annotationMa2;
|
|
51
|
-
var _ref2 =
|
|
51
|
+
var _ref2 = _utils2.inlineCommentPluginKey.getState(editorView.state) || {},
|
|
52
52
|
isDrafting = _ref2.isDrafting,
|
|
53
53
|
selectedAnnotations = _ref2.selectedAnnotations;
|
|
54
54
|
if (isDrafting) {
|
|
@@ -70,13 +70,13 @@ var startDraft = exports.startDraft = function startDraft(editorView, options) {
|
|
|
70
70
|
data: {
|
|
71
71
|
annotationId: annotation.id,
|
|
72
72
|
isSelected: false,
|
|
73
|
-
inlineNodeTypes: (_getAnnotationInlineN = (0,
|
|
73
|
+
inlineNodeTypes: (_getAnnotationInlineN = (0, _annotation2.getAnnotationInlineNodeTypes)(editorView.state, annotation.id)) !== null && _getAnnotationInlineN !== void 0 ? _getAnnotationInlineN : []
|
|
74
74
|
}
|
|
75
75
|
});
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
78
|
(0, _editorCommands.setInlineCommentDraftState)(options.editorAnalyticsAPI, options.provider.supportedBlockNodes, options.api, options.provider.isBlockNodeSupported)(true)(editorView.state, editorView.dispatch);
|
|
79
|
-
var _ref3 =
|
|
79
|
+
var _ref3 = _utils2.inlineCommentPluginKey.getState(editorView.state) || {},
|
|
80
80
|
draftDecorationSet = _ref3.draftDecorationSet;
|
|
81
81
|
var decorations = draftDecorationSet === null || draftDecorationSet === void 0 ? void 0 : draftDecorationSet.find();
|
|
82
82
|
|
|
@@ -89,7 +89,7 @@ var startDraft = exports.startDraft = function startDraft(editorView, options) {
|
|
|
89
89
|
}
|
|
90
90
|
var from = decorations[0].from;
|
|
91
91
|
var targetElement = domRefFromPos(editorView, from);
|
|
92
|
-
var inlineNodeTypes = (_getRangeInlineNodeNa = (0,
|
|
92
|
+
var inlineNodeTypes = (_getRangeInlineNodeNa = (0, _annotation2.getRangeInlineNodeNames)({
|
|
93
93
|
doc: editorView.state.doc,
|
|
94
94
|
pos: {
|
|
95
95
|
from: from,
|
|
@@ -115,7 +115,7 @@ var startDraft = exports.startDraft = function startDraft(editorView, options) {
|
|
|
115
115
|
};
|
|
116
116
|
var clearDraft = exports.clearDraft = function clearDraft(editorView, options) {
|
|
117
117
|
return function () {
|
|
118
|
-
var _ref4 =
|
|
118
|
+
var _ref4 = _utils2.inlineCommentPluginKey.getState(editorView.state) || {},
|
|
119
119
|
isDrafting = _ref4.isDrafting,
|
|
120
120
|
draftDecorationSet = _ref4.draftDecorationSet;
|
|
121
121
|
if (!isDrafting) {
|
|
@@ -141,7 +141,7 @@ var clearDraft = exports.clearDraft = function clearDraft(editorView, options) {
|
|
|
141
141
|
var applyDraft = exports.applyDraft = function applyDraft(editorView, options) {
|
|
142
142
|
return function (id) {
|
|
143
143
|
var _options$annotationMa3, _getAnnotationInlineN2;
|
|
144
|
-
var _ref5 =
|
|
144
|
+
var _ref5 = _utils2.inlineCommentPluginKey.getState(editorView.state) || {},
|
|
145
145
|
isDrafting = _ref5.isDrafting,
|
|
146
146
|
draftDecorationSet = _ref5.draftDecorationSet,
|
|
147
147
|
bookmark = _ref5.bookmark;
|
|
@@ -173,7 +173,7 @@ var applyDraft = exports.applyDraft = function applyDraft(editorView, options) {
|
|
|
173
173
|
data: {
|
|
174
174
|
annotationId: id,
|
|
175
175
|
isSelected: true,
|
|
176
|
-
inlineNodeTypes: (_getAnnotationInlineN2 = (0,
|
|
176
|
+
inlineNodeTypes: (_getAnnotationInlineN2 = (0, _annotation2.getAnnotationInlineNodeTypes)(editorView.state, id)) !== null && _getAnnotationInlineN2 !== void 0 ? _getAnnotationInlineN2 : []
|
|
177
177
|
}
|
|
178
178
|
});
|
|
179
179
|
return {
|
|
@@ -188,7 +188,7 @@ var applyDraft = exports.applyDraft = function applyDraft(editorView, options) {
|
|
|
188
188
|
var getDraft = exports.getDraft = function getDraft(editorView, _options) {
|
|
189
189
|
return function () {
|
|
190
190
|
var _getRangeInlineNodeNa2;
|
|
191
|
-
var _ref6 =
|
|
191
|
+
var _ref6 = _utils2.inlineCommentPluginKey.getState(editorView.state) || {},
|
|
192
192
|
isDrafting = _ref6.isDrafting,
|
|
193
193
|
draftDecorationSet = _ref6.draftDecorationSet;
|
|
194
194
|
if (!isDrafting) {
|
|
@@ -206,7 +206,7 @@ var getDraft = exports.getDraft = function getDraft(editorView, _options) {
|
|
|
206
206
|
}
|
|
207
207
|
var from = decorations[0].from;
|
|
208
208
|
var targetElement = domRefFromPos(editorView, from);
|
|
209
|
-
var inlineNodeTypes = (_getRangeInlineNodeNa2 = (0,
|
|
209
|
+
var inlineNodeTypes = (_getRangeInlineNodeNa2 = (0, _annotation2.getRangeInlineNodeNames)({
|
|
210
210
|
doc: editorView.state.doc,
|
|
211
211
|
pos: {
|
|
212
212
|
from: from,
|
|
@@ -224,7 +224,7 @@ var getDraft = exports.getDraft = function getDraft(editorView, _options) {
|
|
|
224
224
|
var setIsAnnotationSelected = exports.setIsAnnotationSelected = function setIsAnnotationSelected(editorView, options) {
|
|
225
225
|
return function (id, isSelected) {
|
|
226
226
|
var _selectedAnnotations$;
|
|
227
|
-
var _ref7 =
|
|
227
|
+
var _ref7 = _utils2.inlineCommentPluginKey.getState(editorView.state) || {},
|
|
228
228
|
annotations = _ref7.annotations,
|
|
229
229
|
isDrafting = _ref7.isDrafting,
|
|
230
230
|
selectedAnnotations = _ref7.selectedAnnotations;
|
|
@@ -257,7 +257,7 @@ var setIsAnnotationSelected = exports.setIsAnnotationSelected = function setIsAn
|
|
|
257
257
|
data: {
|
|
258
258
|
annotationId: id,
|
|
259
259
|
isSelected: false,
|
|
260
|
-
inlineNodeTypes: (_getAnnotationInlineN3 = (0,
|
|
260
|
+
inlineNodeTypes: (_getAnnotationInlineN3 = (0, _annotation2.getAnnotationInlineNodeTypes)(editorView.state, id)) !== null && _getAnnotationInlineN3 !== void 0 ? _getAnnotationInlineN3 : []
|
|
261
261
|
}
|
|
262
262
|
});
|
|
263
263
|
} else if (!isCurrentlySelected && isSelected) {
|
|
@@ -274,7 +274,7 @@ var setIsAnnotationSelected = exports.setIsAnnotationSelected = function setIsAn
|
|
|
274
274
|
data: {
|
|
275
275
|
annotationId: annotation.id,
|
|
276
276
|
isSelected: false,
|
|
277
|
-
inlineNodeTypes: (_getAnnotationInlineN4 = (0,
|
|
277
|
+
inlineNodeTypes: (_getAnnotationInlineN4 = (0, _annotation2.getAnnotationInlineNodeTypes)(editorView.state, annotation.id)) !== null && _getAnnotationInlineN4 !== void 0 ? _getAnnotationInlineN4 : []
|
|
278
278
|
}
|
|
279
279
|
});
|
|
280
280
|
}
|
|
@@ -286,7 +286,7 @@ var setIsAnnotationSelected = exports.setIsAnnotationSelected = function setIsAn
|
|
|
286
286
|
data: {
|
|
287
287
|
annotationId: id,
|
|
288
288
|
isSelected: true,
|
|
289
|
-
inlineNodeTypes: (_getAnnotationInlineN5 = (0,
|
|
289
|
+
inlineNodeTypes: (_getAnnotationInlineN5 = (0, _annotation2.getAnnotationInlineNodeTypes)(editorView.state, id)) !== null && _getAnnotationInlineN5 !== void 0 ? _getAnnotationInlineN5 : []
|
|
290
290
|
}
|
|
291
291
|
});
|
|
292
292
|
}
|
|
@@ -300,7 +300,7 @@ var setIsAnnotationSelected = exports.setIsAnnotationSelected = function setIsAn
|
|
|
300
300
|
var setIsAnnotationHovered = exports.setIsAnnotationHovered = function setIsAnnotationHovered(editorView, _options) {
|
|
301
301
|
return function (id, isHovered) {
|
|
302
302
|
var _hoveredAnnotations$f;
|
|
303
|
-
var _ref8 =
|
|
303
|
+
var _ref8 = _utils2.inlineCommentPluginKey.getState(editorView.state) || {},
|
|
304
304
|
annotations = _ref8.annotations,
|
|
305
305
|
hoveredAnnotations = _ref8.hoveredAnnotations;
|
|
306
306
|
|
|
@@ -333,7 +333,7 @@ var setIsAnnotationHovered = exports.setIsAnnotationHovered = function setIsAnno
|
|
|
333
333
|
};
|
|
334
334
|
var clearAnnotation = exports.clearAnnotation = function clearAnnotation(editorView, options) {
|
|
335
335
|
return function (id) {
|
|
336
|
-
var _ref9 =
|
|
336
|
+
var _ref9 = _utils2.inlineCommentPluginKey.getState(editorView.state) || {},
|
|
337
337
|
annotations = _ref9.annotations;
|
|
338
338
|
|
|
339
339
|
// If there is no annotation state with this id then we can assume the annotation is invalid.
|
|
@@ -9,18 +9,18 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
|
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
11
|
var _annotation = require("@atlaskit/adf-schema/annotation");
|
|
12
|
-
var
|
|
12
|
+
var _inlineCommentEvents = require("@atlaskit/editor-common/analytics/types/inline-comment-events");
|
|
13
13
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
14
|
-
var
|
|
14
|
+
var _annotation2 = require("@atlaskit/editor-common/utils/annotation");
|
|
15
15
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
16
16
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
17
17
|
var _editorCommands = require("../editor-commands");
|
|
18
|
-
var
|
|
18
|
+
var _utils = require("../editor-commands/utils");
|
|
19
19
|
var _nodeviews = require("../nodeviews");
|
|
20
20
|
var _annotationManagerHooks = require("./annotation-manager-hooks");
|
|
21
21
|
var _pluginFactory = require("./plugin-factory");
|
|
22
22
|
var _toolbar = require("./toolbar");
|
|
23
|
-
var
|
|
23
|
+
var _utils2 = require("./utils");
|
|
24
24
|
var fetchProviderStates = /*#__PURE__*/function () {
|
|
25
25
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(provider, annotationIds) {
|
|
26
26
|
var data, result;
|
|
@@ -71,7 +71,7 @@ var fetchState = /*#__PURE__*/function () {
|
|
|
71
71
|
_context2.next = 2;
|
|
72
72
|
break;
|
|
73
73
|
}
|
|
74
|
-
_ref3 = (0,
|
|
74
|
+
_ref3 = (0, _utils2.getPluginState)(editorView.state) || {}, annotationsLoaded = _ref3.annotationsLoaded;
|
|
75
75
|
if (!annotationsLoaded) {
|
|
76
76
|
(0, _editorCommands.setInlineCommentsFetched)()(editorView.state, editorView.dispatch);
|
|
77
77
|
}
|
|
@@ -125,7 +125,7 @@ var hideToolbar = function hideToolbar(state, dispatch) {
|
|
|
125
125
|
var onResolve = function onResolve(editorAnalyticsAPI) {
|
|
126
126
|
return function (state, dispatch) {
|
|
127
127
|
return function (annotationId) {
|
|
128
|
-
(0, _editorCommands.updateInlineCommentResolvedState)(editorAnalyticsAPI)((0, _defineProperty2.default)({}, annotationId, true),
|
|
128
|
+
(0, _editorCommands.updateInlineCommentResolvedState)(editorAnalyticsAPI)((0, _defineProperty2.default)({}, annotationId, true), _inlineCommentEvents.RESOLVE_METHOD.CONSUMER)(state, dispatch);
|
|
129
129
|
};
|
|
130
130
|
};
|
|
131
131
|
};
|
|
@@ -138,7 +138,7 @@ var onUnResolve = function onUnResolve(editorAnalyticsAPI) {
|
|
|
138
138
|
};
|
|
139
139
|
var onMouseUp = function onMouseUp(state, dispatch) {
|
|
140
140
|
return function (e) {
|
|
141
|
-
var _ref4 = (0,
|
|
141
|
+
var _ref4 = (0, _utils2.getPluginState)(state) || {},
|
|
142
142
|
mouseData = _ref4.mouseData;
|
|
143
143
|
if (mouseData !== null && mouseData !== void 0 && mouseData.isSelecting) {
|
|
144
144
|
(0, _editorCommands.updateMouseState)({
|
|
@@ -166,7 +166,7 @@ var inlineCommentPlugin = exports.inlineCommentPlugin = function inlineCommentPl
|
|
|
166
166
|
featureFlagsPluginState = options.featureFlagsPluginState,
|
|
167
167
|
annotationManager = options.annotationManager;
|
|
168
168
|
return new _safePlugin.SafePlugin({
|
|
169
|
-
key:
|
|
169
|
+
key: _utils2.inlineCommentPluginKey,
|
|
170
170
|
state: (0, _pluginFactory.createPluginState)(options.dispatch, initialState(provider.disallowOnWhitespace, featureFlagsPluginState, !!annotationManager)),
|
|
171
171
|
view: function view(editorView) {
|
|
172
172
|
var allowAnnotationFn;
|
|
@@ -197,7 +197,7 @@ var inlineCommentPlugin = exports.inlineCommentPlugin = function inlineCommentPl
|
|
|
197
197
|
}
|
|
198
198
|
// Get initial state
|
|
199
199
|
// Need to pass `editorView` to mitigate editor state going stale
|
|
200
|
-
fetchState(provider, (0,
|
|
200
|
+
fetchState(provider, (0, _utils2.getAllAnnotations)(editorView.state.doc), editorView, options.editorAnalyticsAPI);
|
|
201
201
|
var resolve = function resolve(annotationId) {
|
|
202
202
|
return onResolve(options.editorAnalyticsAPI)(editorView.state, editorView.dispatch)(annotationId);
|
|
203
203
|
};
|
|
@@ -247,12 +247,12 @@ var inlineCommentPlugin = exports.inlineCommentPlugin = function inlineCommentPl
|
|
|
247
247
|
return {
|
|
248
248
|
update: function update(view, _prevState) {
|
|
249
249
|
var _prevSelectedAnnotati;
|
|
250
|
-
var _ref5 = (0,
|
|
250
|
+
var _ref5 = (0, _utils2.getPluginState)(view.state) || {},
|
|
251
251
|
selectedAnnotations = _ref5.selectedAnnotations,
|
|
252
252
|
annotations = _ref5.annotations,
|
|
253
253
|
isDrafting = _ref5.isDrafting,
|
|
254
254
|
bookmark = _ref5.bookmark;
|
|
255
|
-
var _ref6 = (0,
|
|
255
|
+
var _ref6 = (0, _utils2.getPluginState)(_prevState) || {},
|
|
256
256
|
prevSelectedAnnotations = _ref6.selectedAnnotations;
|
|
257
257
|
var selectedAnnotationId = selectedAnnotations && selectedAnnotations.length !== 0 && selectedAnnotations[0].id ? selectedAnnotations[0].id : undefined;
|
|
258
258
|
|
|
@@ -281,9 +281,9 @@ var inlineCommentPlugin = exports.inlineCommentPlugin = function inlineCommentPl
|
|
|
281
281
|
state: view.state,
|
|
282
282
|
bookmark: bookmark
|
|
283
283
|
})) {
|
|
284
|
-
(0,
|
|
284
|
+
(0, _utils.setUserIntent)(api, tr);
|
|
285
285
|
} else {
|
|
286
|
-
(0,
|
|
286
|
+
(0, _utils.resetUserIntent)(api, tr);
|
|
287
287
|
}
|
|
288
288
|
return tr;
|
|
289
289
|
});
|
|
@@ -297,17 +297,17 @@ var inlineCommentPlugin = exports.inlineCommentPlugin = function inlineCommentPl
|
|
|
297
297
|
// at a time when changing the selection could cause data loss.
|
|
298
298
|
// The following preemptive check is designed to cover these items.
|
|
299
299
|
|
|
300
|
-
var _ref8 = (0,
|
|
300
|
+
var _ref8 = (0, _utils2.getPluginState)(view.state) || {},
|
|
301
301
|
pendingSelectedAnnotations = _ref8.pendingSelectedAnnotations,
|
|
302
302
|
pendingSelectedAnnotationsUpdateCount = _ref8.pendingSelectedAnnotationsUpdateCount;
|
|
303
|
-
var _ref9 = (0,
|
|
303
|
+
var _ref9 = (0, _utils2.getPluginState)(_prevState) || {},
|
|
304
304
|
prevPendingSelectedAnnotationsUpdateCount = _ref9.pendingSelectedAnnotationsUpdateCount;
|
|
305
305
|
if (!isPreemptiveGateActive && pendingSelectedAnnotationsUpdateCount !== prevPendingSelectedAnnotationsUpdateCount && !!(pendingSelectedAnnotations !== null && pendingSelectedAnnotations !== void 0 && pendingSelectedAnnotations.length)) {
|
|
306
306
|
// Need to set a lock to avoid calling gate multiple times. The lock will be released
|
|
307
307
|
// when the preemptive gate is complete.
|
|
308
308
|
isPreemptiveGateActive = true;
|
|
309
309
|
annotationManager.checkPreemptiveGate().then(function (canSelectAnnotation) {
|
|
310
|
-
var _ref0 = (0,
|
|
310
|
+
var _ref0 = (0, _utils2.getPluginState)(view.state) || {},
|
|
311
311
|
isDrafting = _ref0.isDrafting,
|
|
312
312
|
latestPendingSelectedAnnotations = _ref0.pendingSelectedAnnotations,
|
|
313
313
|
latestSelectedAnnotations = _ref0.selectedAnnotations;
|
|
@@ -331,7 +331,7 @@ var inlineCommentPlugin = exports.inlineCommentPlugin = function inlineCommentPl
|
|
|
331
331
|
data: {
|
|
332
332
|
annotationId: annotation.id,
|
|
333
333
|
isSelected: false,
|
|
334
|
-
inlineNodeTypes: (_getAnnotationInlineN = (0,
|
|
334
|
+
inlineNodeTypes: (_getAnnotationInlineN = (0, _annotation2.getAnnotationInlineNodeTypes)(editorView.state, annotation.id)) !== null && _getAnnotationInlineN !== void 0 ? _getAnnotationInlineN : []
|
|
335
335
|
}
|
|
336
336
|
});
|
|
337
337
|
});
|
|
@@ -345,7 +345,7 @@ var inlineCommentPlugin = exports.inlineCommentPlugin = function inlineCommentPl
|
|
|
345
345
|
data: {
|
|
346
346
|
annotationId: id,
|
|
347
347
|
isSelected: true,
|
|
348
|
-
inlineNodeTypes: (_getAnnotationInlineN2 = (0,
|
|
348
|
+
inlineNodeTypes: (_getAnnotationInlineN2 = (0, _annotation2.getAnnotationInlineNodeTypes)(view.state, id)) !== null && _getAnnotationInlineN2 !== void 0 ? _getAnnotationInlineN2 : []
|
|
349
349
|
}
|
|
350
350
|
});
|
|
351
351
|
});
|
|
@@ -363,13 +363,13 @@ var inlineCommentPlugin = exports.inlineCommentPlugin = function inlineCommentPl
|
|
|
363
363
|
});
|
|
364
364
|
}
|
|
365
365
|
}
|
|
366
|
-
var _ref10 = (0,
|
|
366
|
+
var _ref10 = (0, _utils2.getPluginState)(view.state) || {},
|
|
367
367
|
dirtyAnnotations = _ref10.dirtyAnnotations;
|
|
368
368
|
if (!dirtyAnnotations) {
|
|
369
369
|
return;
|
|
370
370
|
}
|
|
371
371
|
(0, _editorCommands.clearDirtyMark)()(view.state, view.dispatch);
|
|
372
|
-
fetchState(provider, (0,
|
|
372
|
+
fetchState(provider, (0, _utils2.getAllAnnotations)(view.state.doc), view, options.editorAnalyticsAPI);
|
|
373
373
|
},
|
|
374
374
|
destroy: function destroy() {
|
|
375
375
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
@@ -393,7 +393,7 @@ var inlineCommentPlugin = exports.inlineCommentPlugin = function inlineCommentPl
|
|
|
393
393
|
props: {
|
|
394
394
|
handleDOMEvents: {
|
|
395
395
|
mousedown: function mousedown(view) {
|
|
396
|
-
var pluginState = (0,
|
|
396
|
+
var pluginState = (0, _utils2.getPluginState)(view.state);
|
|
397
397
|
if (!(pluginState !== null && pluginState !== void 0 && pluginState.mouseData.isSelecting)) {
|
|
398
398
|
hideToolbar(view.state, view.dispatch)();
|
|
399
399
|
}
|
|
@@ -415,7 +415,7 @@ var inlineCommentPlugin = exports.inlineCommentPlugin = function inlineCommentPl
|
|
|
415
415
|
if (!annotationId) {
|
|
416
416
|
return false;
|
|
417
417
|
}
|
|
418
|
-
var pluginState = (0,
|
|
418
|
+
var pluginState = (0, _utils2.getPluginState)(view.state);
|
|
419
419
|
var isSelected = pluginState === null || pluginState === void 0 || (_pluginState$selected = pluginState.selectedAnnotations) === null || _pluginState$selected === void 0 ? void 0 : _pluginState$selected.some(function (selectedAnnotation) {
|
|
420
420
|
return selectedAnnotation.id === annotationId;
|
|
421
421
|
});
|
|
@@ -453,7 +453,7 @@ var inlineCommentPlugin = exports.inlineCommentPlugin = function inlineCommentPl
|
|
|
453
453
|
},
|
|
454
454
|
decorations: function decorations(state) {
|
|
455
455
|
// highlight comments, depending on state
|
|
456
|
-
var _ref12 = (0,
|
|
456
|
+
var _ref12 = (0, _utils2.getPluginState)(state) || {},
|
|
457
457
|
draftDecorationSet = _ref12.draftDecorationSet,
|
|
458
458
|
annotations = _ref12.annotations,
|
|
459
459
|
selectedAnnotations = _ref12.selectedAnnotations,
|
|
@@ -468,7 +468,7 @@ var inlineCommentPlugin = exports.inlineCommentPlugin = function inlineCommentPl
|
|
|
468
468
|
// the decorations in plugin state and only updating them when required.
|
|
469
469
|
state.doc.descendants(function (node, pos) {
|
|
470
470
|
// Do not render saved chart marks as text highlights when annotation support is off.
|
|
471
|
-
if ((0,
|
|
471
|
+
if ((0, _utils2.shouldHideRemixAnnotation)(node)) {
|
|
472
472
|
return false;
|
|
473
473
|
}
|
|
474
474
|
// Inline comment on mediaInline is not supported as part of comments on media project
|
|
@@ -476,7 +476,7 @@ var inlineCommentPlugin = exports.inlineCommentPlugin = function inlineCommentPl
|
|
|
476
476
|
if (node.type.name === 'mediaInline') {
|
|
477
477
|
return false;
|
|
478
478
|
}
|
|
479
|
-
var isSupportedBlock = node.isBlock && (0,
|
|
479
|
+
var isSupportedBlock = node.isBlock && (0, _utils2.isSupportedBlockNode)(node, provider.supportedBlockNodes, provider.isBlockNodeSupported);
|
|
480
480
|
node.marks.filter(function (mark) {
|
|
481
481
|
return mark.type === state.schema.marks.annotation;
|
|
482
482
|
}).forEach(function (mark) {
|
|
@@ -492,7 +492,7 @@ var inlineCommentPlugin = exports.inlineCommentPlugin = function inlineCommentPl
|
|
|
492
492
|
focusDecorations.push(_view.Decoration.node(pos, pos + node.nodeSize, {
|
|
493
493
|
class: "".concat((0, _nodeviews.getBlockAnnotationViewClassname)(isUnresolved, isSelected), " ").concat(isUnresolved)
|
|
494
494
|
}, {
|
|
495
|
-
key:
|
|
495
|
+
key: _utils2.decorationKey.block
|
|
496
496
|
}));
|
|
497
497
|
} else {
|
|
498
498
|
if ((0, _fg.fg)('editor_inline_comments_on_inline_nodes')) {
|
|
@@ -505,7 +505,7 @@ var inlineCommentPlugin = exports.inlineCommentPlugin = function inlineCommentPl
|
|
|
505
505
|
focusDecorations.push(_view.Decoration.node(pos, pos + node.nodeSize, {
|
|
506
506
|
class: "".concat((0, _nodeviews.getAnnotationViewClassname)(isUnresolved, isSelected, isHovered), " ").concat(isUnresolved)
|
|
507
507
|
}, {
|
|
508
|
-
key:
|
|
508
|
+
key: _utils2.decorationKey.block
|
|
509
509
|
}));
|
|
510
510
|
}
|
|
511
511
|
} else {
|