@atlaskit/editor-core 187.20.1 → 187.21.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 +6 -0
- package/dist/cjs/plugins/annotation/commands/index.js +13 -1
- package/dist/cjs/plugins/annotation/pm-plugins/inline-comment.js +9 -2
- package/dist/cjs/plugins/annotation/pm-plugins/reducer.js +4 -0
- package/dist/cjs/plugins/annotation/pm-plugins/types.js +1 -0
- package/dist/cjs/plugins/annotation/ui/InlineCommentView.js +2 -0
- package/dist/cjs/plugins/annotation/utils.js +1 -1
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/plugins/annotation/commands/index.js +9 -0
- package/dist/es2019/plugins/annotation/pm-plugins/inline-comment.js +10 -3
- package/dist/es2019/plugins/annotation/pm-plugins/reducer.js +5 -0
- package/dist/es2019/plugins/annotation/pm-plugins/types.js +1 -0
- package/dist/es2019/plugins/annotation/ui/InlineCommentView.js +3 -1
- package/dist/es2019/plugins/annotation/utils.js +1 -1
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/plugins/annotation/commands/index.js +11 -0
- package/dist/esm/plugins/annotation/pm-plugins/inline-comment.js +10 -3
- package/dist/esm/plugins/annotation/pm-plugins/reducer.js +4 -0
- package/dist/esm/plugins/annotation/pm-plugins/types.js +1 -0
- package/dist/esm/plugins/annotation/ui/InlineCommentView.js +3 -1
- package/dist/esm/plugins/annotation/utils.js +1 -1
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/plugins/annotation/commands/index.d.ts +1 -0
- package/dist/types/plugins/annotation/pm-plugins/types.d.ts +7 -1
- package/dist/types/plugins/annotation/types.d.ts +4 -0
- package/dist/types/plugins/annotation/update-provider.d.ts +1 -1
- package/dist/types-ts4.5/plugins/annotation/commands/index.d.ts +1 -0
- package/dist/types-ts4.5/plugins/annotation/pm-plugins/types.d.ts +7 -1
- package/dist/types-ts4.5/plugins/annotation/types.d.ts +4 -0
- package/dist/types-ts4.5/plugins/annotation/update-provider.d.ts +1 -1
- package/package.json +2 -2
- package/report.api.md +7 -1
- package/tmp/api-report-tmp.d.ts +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.updateMouseState = exports.updateInlineCommentResolvedState = exports.setInlineCommentsVisibility = exports.setInlineCommentDraftState = exports.removeInlineCommentNearSelection = exports.createAnnotation = exports.closeComponent = exports.clearDirtyMark = exports.addInlineComment = void 0;
|
|
7
|
+
exports.updateMouseState = exports.updateInlineCommentResolvedState = exports.setSelectedAnnotation = exports.setInlineCommentsVisibility = exports.setInlineCommentDraftState = exports.removeInlineCommentNearSelection = exports.createAnnotation = exports.closeComponent = exports.clearDirtyMark = exports.addInlineComment = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
10
10
|
var _pluginFactory = require("../pm-plugins/plugin-factory");
|
|
@@ -113,6 +113,18 @@ var updateMouseState = function updateMouseState(mouseData) {
|
|
|
113
113
|
});
|
|
114
114
|
};
|
|
115
115
|
exports.updateMouseState = updateMouseState;
|
|
116
|
+
var setSelectedAnnotation = function setSelectedAnnotation(id) {
|
|
117
|
+
return (0, _pluginFactory.createCommand)({
|
|
118
|
+
type: _types.ACTIONS.SET_SELECTED_ANNOTATION,
|
|
119
|
+
data: {
|
|
120
|
+
selectedAnnotations: [{
|
|
121
|
+
id: id,
|
|
122
|
+
type: _adfSchema.AnnotationTypes.INLINE_COMMENT
|
|
123
|
+
}]
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
};
|
|
127
|
+
exports.setSelectedAnnotation = setSelectedAnnotation;
|
|
116
128
|
var createAnnotation = function createAnnotation(id) {
|
|
117
129
|
var annotationType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _adfSchema.AnnotationTypes.INLINE_COMMENT;
|
|
118
130
|
return function (state, dispatch) {
|
|
@@ -154,9 +154,16 @@ var inlineCommentPlugin = function inlineCommentPlugin(options) {
|
|
|
154
154
|
var setVisibility = function setVisibility(isVisible) {
|
|
155
155
|
return onSetVisibility(editorView)(isVisible);
|
|
156
156
|
};
|
|
157
|
+
var setSelectedAnnotationFn = function setSelectedAnnotationFn(annotationId) {
|
|
158
|
+
if (!annotationId) {
|
|
159
|
+
(0, _commands.closeComponent)()(editorView.state, editorView.dispatch);
|
|
160
|
+
} else {
|
|
161
|
+
(0, _commands.setSelectedAnnotation)(annotationId)(editorView.state, editorView.dispatch);
|
|
162
|
+
}
|
|
163
|
+
};
|
|
157
164
|
var updateSubscriber = provider.updateSubscriber;
|
|
158
165
|
if (updateSubscriber) {
|
|
159
|
-
updateSubscriber.on('resolve', resolve).on('delete', resolve).on('unresolve', unResolve).on('create', unResolve).on('setvisibility', setVisibility);
|
|
166
|
+
updateSubscriber.on('resolve', resolve).on('delete', resolve).on('unresolve', unResolve).on('create', unResolve).on('setvisibility', setVisibility).on('setselectedannotation', setSelectedAnnotationFn);
|
|
160
167
|
}
|
|
161
168
|
editorView.root.addEventListener('mouseup', mouseUp);
|
|
162
169
|
return {
|
|
@@ -172,7 +179,7 @@ var inlineCommentPlugin = function inlineCommentPlugin(options) {
|
|
|
172
179
|
destroy: function destroy() {
|
|
173
180
|
editorView.root.removeEventListener('mouseup', mouseUp);
|
|
174
181
|
if (updateSubscriber) {
|
|
175
|
-
updateSubscriber.off('resolve', resolve).off('delete', resolve).off('unresolve', unResolve).off('create', unResolve).off('setvisibility', setVisibility);
|
|
182
|
+
updateSubscriber.off('resolve', resolve).off('delete', resolve).off('unresolve', unResolve).off('create', unResolve).off('setvisibility', setVisibility).off('setselectedannotation', setSelectedAnnotationFn);
|
|
176
183
|
}
|
|
177
184
|
}
|
|
178
185
|
};
|
|
@@ -48,6 +48,10 @@ var _default = function _default(pluginState, action) {
|
|
|
48
48
|
return _objectSpread(_objectSpread({}, isVisible ? pluginState : getNewDraftState(pluginState, false)), {}, {
|
|
49
49
|
isVisible: isVisible
|
|
50
50
|
});
|
|
51
|
+
case _types.ACTIONS.SET_SELECTED_ANNOTATION:
|
|
52
|
+
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
53
|
+
selectedAnnotations: (0, _toConsumableArray2.default)(action.data.selectedAnnotations)
|
|
54
|
+
});
|
|
51
55
|
default:
|
|
52
56
|
return pluginState;
|
|
53
57
|
}
|
|
@@ -12,6 +12,7 @@ var ACTIONS = /*#__PURE__*/function (ACTIONS) {
|
|
|
12
12
|
ACTIONS[ACTIONS["ADD_INLINE_COMMENT"] = 4] = "ADD_INLINE_COMMENT";
|
|
13
13
|
ACTIONS[ACTIONS["INLINE_COMMENT_SET_VISIBLE"] = 5] = "INLINE_COMMENT_SET_VISIBLE";
|
|
14
14
|
ACTIONS[ACTIONS["CLOSE_COMPONENT"] = 6] = "CLOSE_COMPONENT";
|
|
15
|
+
ACTIONS[ACTIONS["SET_SELECTED_ANNOTATION"] = 7] = "SET_SELECTED_ANNOTATION";
|
|
15
16
|
return ACTIONS;
|
|
16
17
|
}({});
|
|
17
18
|
exports.ACTIONS = ACTIONS;
|
|
@@ -46,6 +46,7 @@ function InlineCommentView(_ref) {
|
|
|
46
46
|
bookmark = _ref2.bookmark,
|
|
47
47
|
selectedAnnotations = _ref2.selectedAnnotations,
|
|
48
48
|
annotations = _ref2.annotations;
|
|
49
|
+
var annotationsList = (0, _utils2.getAllAnnotations)(editorView.state.doc);
|
|
49
50
|
var selection = (0, _utils2.getSelectionPositions)(state, inlineCommentState);
|
|
50
51
|
var position = findPosForDOM(selection);
|
|
51
52
|
var dom;
|
|
@@ -134,6 +135,7 @@ function InlineCommentView(_ref) {
|
|
|
134
135
|
key: (0, _utils2.getAnnotationViewKey)(activeAnnotations),
|
|
135
136
|
onViewed: onAnnotationViewed
|
|
136
137
|
}, /*#__PURE__*/_react.default.createElement(ViewComponent, {
|
|
138
|
+
annotationsList: annotationsList,
|
|
137
139
|
annotations: activeAnnotations,
|
|
138
140
|
dom: dom,
|
|
139
141
|
onDelete: function onDelete(id) {
|
|
@@ -77,7 +77,7 @@ var getAllAnnotations = function getAllAnnotations(doc) {
|
|
|
77
77
|
node.marks.filter(function (mark) {
|
|
78
78
|
return mark.type.name === 'annotation';
|
|
79
79
|
})
|
|
80
|
-
// filter out annotations with invalid
|
|
80
|
+
// filter out annotations with invalid attributes as they cause errors when interacting with them
|
|
81
81
|
.filter(validateAnnotationMark).forEach(function (m) {
|
|
82
82
|
return allAnnotationIds.add(m.attrs.id);
|
|
83
83
|
});
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.version = exports.nextMajorVersion = exports.name = void 0;
|
|
7
7
|
var name = "@atlaskit/editor-core";
|
|
8
8
|
exports.name = name;
|
|
9
|
-
var version = "187.
|
|
9
|
+
var version = "187.21.0";
|
|
10
10
|
exports.version = version;
|
|
11
11
|
var nextMajorVersion = function nextMajorVersion() {
|
|
12
12
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
package/dist/cjs/version.json
CHANGED
|
@@ -91,6 +91,15 @@ export const updateMouseState = mouseData => createCommand({
|
|
|
91
91
|
mouseData
|
|
92
92
|
}
|
|
93
93
|
});
|
|
94
|
+
export const setSelectedAnnotation = id => createCommand({
|
|
95
|
+
type: ACTIONS.SET_SELECTED_ANNOTATION,
|
|
96
|
+
data: {
|
|
97
|
+
selectedAnnotations: [{
|
|
98
|
+
id,
|
|
99
|
+
type: AnnotationTypes.INLINE_COMMENT
|
|
100
|
+
}]
|
|
101
|
+
}
|
|
102
|
+
});
|
|
94
103
|
export const createAnnotation = (id, annotationType = AnnotationTypes.INLINE_COMMENT) => (state, dispatch) => {
|
|
95
104
|
// don't try to add if there are is no temp highlight bookmarked
|
|
96
105
|
const {
|
|
@@ -3,7 +3,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
3
3
|
import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
4
4
|
import { AnnotationTypes } from '@atlaskit/adf-schema';
|
|
5
5
|
import { AnnotationNodeView, getAnnotationViewClassname } from '../nodeviews';
|
|
6
|
-
import { updateInlineCommentResolvedState, updateMouseState, clearDirtyMark, setInlineCommentsVisibility } from '../commands';
|
|
6
|
+
import { updateInlineCommentResolvedState, updateMouseState, clearDirtyMark, setInlineCommentsVisibility, setSelectedAnnotation, closeComponent } from '../commands';
|
|
7
7
|
import { getAllAnnotations, inlineCommentPluginKey, getPluginState } from '../utils';
|
|
8
8
|
import { createPluginState } from './plugin-factory';
|
|
9
9
|
const fetchProviderStates = async (provider, annotationIds) => {
|
|
@@ -97,11 +97,18 @@ export const inlineCommentPlugin = options => {
|
|
|
97
97
|
const unResolve = annotationId => onUnResolve(editorView.state, editorView.dispatch)(annotationId);
|
|
98
98
|
const mouseUp = event => onMouseUp(editorView.state, editorView.dispatch)(event);
|
|
99
99
|
const setVisibility = isVisible => onSetVisibility(editorView)(isVisible);
|
|
100
|
+
const setSelectedAnnotationFn = annotationId => {
|
|
101
|
+
if (!annotationId) {
|
|
102
|
+
closeComponent()(editorView.state, editorView.dispatch);
|
|
103
|
+
} else {
|
|
104
|
+
setSelectedAnnotation(annotationId)(editorView.state, editorView.dispatch);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
100
107
|
const {
|
|
101
108
|
updateSubscriber
|
|
102
109
|
} = provider;
|
|
103
110
|
if (updateSubscriber) {
|
|
104
|
-
updateSubscriber.on('resolve', resolve).on('delete', resolve).on('unresolve', unResolve).on('create', unResolve).on('setvisibility', setVisibility);
|
|
111
|
+
updateSubscriber.on('resolve', resolve).on('delete', resolve).on('unresolve', unResolve).on('create', unResolve).on('setvisibility', setVisibility).on('setselectedannotation', setSelectedAnnotationFn);
|
|
105
112
|
}
|
|
106
113
|
editorView.root.addEventListener('mouseup', mouseUp);
|
|
107
114
|
return {
|
|
@@ -118,7 +125,7 @@ export const inlineCommentPlugin = options => {
|
|
|
118
125
|
destroy() {
|
|
119
126
|
editorView.root.removeEventListener('mouseup', mouseUp);
|
|
120
127
|
if (updateSubscriber) {
|
|
121
|
-
updateSubscriber.off('resolve', resolve).off('delete', resolve).off('unresolve', unResolve).off('create', unResolve).off('setvisibility', setVisibility);
|
|
128
|
+
updateSubscriber.off('resolve', resolve).off('delete', resolve).off('unresolve', unResolve).off('create', unResolve).off('setvisibility', setVisibility).off('setselectedannotation', setSelectedAnnotationFn);
|
|
122
129
|
}
|
|
123
130
|
}
|
|
124
131
|
};
|
|
@@ -51,6 +51,11 @@ export default ((pluginState, action) => {
|
|
|
51
51
|
...(isVisible ? pluginState : getNewDraftState(pluginState, false)),
|
|
52
52
|
isVisible
|
|
53
53
|
};
|
|
54
|
+
case ACTIONS.SET_SELECTED_ANNOTATION:
|
|
55
|
+
return {
|
|
56
|
+
...pluginState,
|
|
57
|
+
selectedAnnotations: [...action.data.selectedAnnotations]
|
|
58
|
+
};
|
|
54
59
|
default:
|
|
55
60
|
return pluginState;
|
|
56
61
|
}
|
|
@@ -6,5 +6,6 @@ export let ACTIONS = /*#__PURE__*/function (ACTIONS) {
|
|
|
6
6
|
ACTIONS[ACTIONS["ADD_INLINE_COMMENT"] = 4] = "ADD_INLINE_COMMENT";
|
|
7
7
|
ACTIONS[ACTIONS["INLINE_COMMENT_SET_VISIBLE"] = 5] = "INLINE_COMMENT_SET_VISIBLE";
|
|
8
8
|
ACTIONS[ACTIONS["CLOSE_COMPONENT"] = 6] = "CLOSE_COMPONENT";
|
|
9
|
+
ACTIONS[ACTIONS["SET_SELECTED_ANNOTATION"] = 7] = "SET_SELECTED_ANNOTATION";
|
|
9
10
|
return ACTIONS;
|
|
10
11
|
}({});
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
3
3
|
import { AnnotationViewWrapper } from './AnnotationViewWrapper';
|
|
4
4
|
import { AnnotationTestIds } from '../types';
|
|
5
|
-
import { getAnnotationViewKey, getSelectionPositions, getPluginState } from '../utils';
|
|
5
|
+
import { getAnnotationViewKey, getSelectionPositions, getPluginState, getAllAnnotations } from '../utils';
|
|
6
6
|
import { removeInlineCommentNearSelection, updateInlineCommentResolvedState, setInlineCommentDraftState, createAnnotation, closeComponent } from '../commands';
|
|
7
7
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID } from '../../analytics';
|
|
8
8
|
import { CONTENT_COMPONENT } from '../../analytics/types';
|
|
@@ -46,6 +46,7 @@ export function InlineCommentView({
|
|
|
46
46
|
selectedAnnotations,
|
|
47
47
|
annotations
|
|
48
48
|
} = inlineCommentState || {};
|
|
49
|
+
const annotationsList = getAllAnnotations(editorView.state.doc);
|
|
49
50
|
const selection = getSelectionPositions(state, inlineCommentState);
|
|
50
51
|
const position = findPosForDOM(selection);
|
|
51
52
|
let dom;
|
|
@@ -132,6 +133,7 @@ export function InlineCommentView({
|
|
|
132
133
|
key: getAnnotationViewKey(activeAnnotations),
|
|
133
134
|
onViewed: onAnnotationViewed
|
|
134
135
|
}, /*#__PURE__*/React.createElement(ViewComponent, {
|
|
136
|
+
annotationsList: annotationsList,
|
|
135
137
|
annotations: activeAnnotations,
|
|
136
138
|
dom: dom,
|
|
137
139
|
onDelete: id => removeInlineCommentNearSelection(id)(state, dispatch),
|
|
@@ -52,7 +52,7 @@ export const getAllAnnotations = doc => {
|
|
|
52
52
|
const allAnnotationIds = new Set();
|
|
53
53
|
doc.descendants(node => {
|
|
54
54
|
node.marks.filter(mark => mark.type.name === 'annotation')
|
|
55
|
-
// filter out annotations with invalid
|
|
55
|
+
// filter out annotations with invalid attributes as they cause errors when interacting with them
|
|
56
56
|
.filter(validateAnnotationMark).forEach(m => allAnnotationIds.add(m.attrs.id));
|
|
57
57
|
return true;
|
|
58
58
|
});
|
package/dist/es2019/version.json
CHANGED
|
@@ -99,6 +99,17 @@ export var updateMouseState = function updateMouseState(mouseData) {
|
|
|
99
99
|
}
|
|
100
100
|
});
|
|
101
101
|
};
|
|
102
|
+
export var setSelectedAnnotation = function setSelectedAnnotation(id) {
|
|
103
|
+
return createCommand({
|
|
104
|
+
type: ACTIONS.SET_SELECTED_ANNOTATION,
|
|
105
|
+
data: {
|
|
106
|
+
selectedAnnotations: [{
|
|
107
|
+
id: id,
|
|
108
|
+
type: AnnotationTypes.INLINE_COMMENT
|
|
109
|
+
}]
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
};
|
|
102
113
|
export var createAnnotation = function createAnnotation(id) {
|
|
103
114
|
var annotationType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : AnnotationTypes.INLINE_COMMENT;
|
|
104
115
|
return function (state, dispatch) {
|
|
@@ -6,7 +6,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
6
6
|
import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
7
7
|
import { AnnotationTypes } from '@atlaskit/adf-schema';
|
|
8
8
|
import { AnnotationNodeView, getAnnotationViewClassname } from '../nodeviews';
|
|
9
|
-
import { updateInlineCommentResolvedState, updateMouseState, clearDirtyMark, setInlineCommentsVisibility } from '../commands';
|
|
9
|
+
import { updateInlineCommentResolvedState, updateMouseState, clearDirtyMark, setInlineCommentsVisibility, setSelectedAnnotation, closeComponent } from '../commands';
|
|
10
10
|
import { getAllAnnotations, inlineCommentPluginKey, getPluginState } from '../utils';
|
|
11
11
|
import { createPluginState } from './plugin-factory';
|
|
12
12
|
var fetchProviderStates = /*#__PURE__*/function () {
|
|
@@ -147,9 +147,16 @@ export var inlineCommentPlugin = function inlineCommentPlugin(options) {
|
|
|
147
147
|
var setVisibility = function setVisibility(isVisible) {
|
|
148
148
|
return onSetVisibility(editorView)(isVisible);
|
|
149
149
|
};
|
|
150
|
+
var setSelectedAnnotationFn = function setSelectedAnnotationFn(annotationId) {
|
|
151
|
+
if (!annotationId) {
|
|
152
|
+
closeComponent()(editorView.state, editorView.dispatch);
|
|
153
|
+
} else {
|
|
154
|
+
setSelectedAnnotation(annotationId)(editorView.state, editorView.dispatch);
|
|
155
|
+
}
|
|
156
|
+
};
|
|
150
157
|
var updateSubscriber = provider.updateSubscriber;
|
|
151
158
|
if (updateSubscriber) {
|
|
152
|
-
updateSubscriber.on('resolve', resolve).on('delete', resolve).on('unresolve', unResolve).on('create', unResolve).on('setvisibility', setVisibility);
|
|
159
|
+
updateSubscriber.on('resolve', resolve).on('delete', resolve).on('unresolve', unResolve).on('create', unResolve).on('setvisibility', setVisibility).on('setselectedannotation', setSelectedAnnotationFn);
|
|
153
160
|
}
|
|
154
161
|
editorView.root.addEventListener('mouseup', mouseUp);
|
|
155
162
|
return {
|
|
@@ -165,7 +172,7 @@ export var inlineCommentPlugin = function inlineCommentPlugin(options) {
|
|
|
165
172
|
destroy: function destroy() {
|
|
166
173
|
editorView.root.removeEventListener('mouseup', mouseUp);
|
|
167
174
|
if (updateSubscriber) {
|
|
168
|
-
updateSubscriber.off('resolve', resolve).off('delete', resolve).off('unresolve', unResolve).off('create', unResolve).off('setvisibility', setVisibility);
|
|
175
|
+
updateSubscriber.off('resolve', resolve).off('delete', resolve).off('unresolve', unResolve).off('create', unResolve).off('setvisibility', setVisibility).off('setselectedannotation', setSelectedAnnotationFn);
|
|
169
176
|
}
|
|
170
177
|
}
|
|
171
178
|
};
|
|
@@ -41,6 +41,10 @@ export default (function (pluginState, action) {
|
|
|
41
41
|
return _objectSpread(_objectSpread({}, isVisible ? pluginState : getNewDraftState(pluginState, false)), {}, {
|
|
42
42
|
isVisible: isVisible
|
|
43
43
|
});
|
|
44
|
+
case ACTIONS.SET_SELECTED_ANNOTATION:
|
|
45
|
+
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
46
|
+
selectedAnnotations: _toConsumableArray(action.data.selectedAnnotations)
|
|
47
|
+
});
|
|
44
48
|
default:
|
|
45
49
|
return pluginState;
|
|
46
50
|
}
|
|
@@ -6,5 +6,6 @@ export var ACTIONS = /*#__PURE__*/function (ACTIONS) {
|
|
|
6
6
|
ACTIONS[ACTIONS["ADD_INLINE_COMMENT"] = 4] = "ADD_INLINE_COMMENT";
|
|
7
7
|
ACTIONS[ACTIONS["INLINE_COMMENT_SET_VISIBLE"] = 5] = "INLINE_COMMENT_SET_VISIBLE";
|
|
8
8
|
ACTIONS[ACTIONS["CLOSE_COMPONENT"] = 6] = "CLOSE_COMPONENT";
|
|
9
|
+
ACTIONS[ACTIONS["SET_SELECTED_ANNOTATION"] = 7] = "SET_SELECTED_ANNOTATION";
|
|
9
10
|
return ACTIONS;
|
|
10
11
|
}({});
|
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
4
4
|
import { AnnotationViewWrapper } from './AnnotationViewWrapper';
|
|
5
5
|
import { AnnotationTestIds } from '../types';
|
|
6
|
-
import { getAnnotationViewKey, getSelectionPositions, getPluginState } from '../utils';
|
|
6
|
+
import { getAnnotationViewKey, getSelectionPositions, getPluginState, getAllAnnotations } from '../utils';
|
|
7
7
|
import { removeInlineCommentNearSelection, updateInlineCommentResolvedState, setInlineCommentDraftState, createAnnotation, closeComponent } from '../commands';
|
|
8
8
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID } from '../../analytics';
|
|
9
9
|
import { CONTENT_COMPONENT } from '../../analytics/types';
|
|
@@ -39,6 +39,7 @@ export function InlineCommentView(_ref) {
|
|
|
39
39
|
bookmark = _ref2.bookmark,
|
|
40
40
|
selectedAnnotations = _ref2.selectedAnnotations,
|
|
41
41
|
annotations = _ref2.annotations;
|
|
42
|
+
var annotationsList = getAllAnnotations(editorView.state.doc);
|
|
42
43
|
var selection = getSelectionPositions(state, inlineCommentState);
|
|
43
44
|
var position = findPosForDOM(selection);
|
|
44
45
|
var dom;
|
|
@@ -127,6 +128,7 @@ export function InlineCommentView(_ref) {
|
|
|
127
128
|
key: getAnnotationViewKey(activeAnnotations),
|
|
128
129
|
onViewed: onAnnotationViewed
|
|
129
130
|
}, /*#__PURE__*/React.createElement(ViewComponent, {
|
|
131
|
+
annotationsList: annotationsList,
|
|
130
132
|
annotations: activeAnnotations,
|
|
131
133
|
dom: dom,
|
|
132
134
|
onDelete: function onDelete(id) {
|
|
@@ -60,7 +60,7 @@ export var getAllAnnotations = function getAllAnnotations(doc) {
|
|
|
60
60
|
node.marks.filter(function (mark) {
|
|
61
61
|
return mark.type.name === 'annotation';
|
|
62
62
|
})
|
|
63
|
-
// filter out annotations with invalid
|
|
63
|
+
// filter out annotations with invalid attributes as they cause errors when interacting with them
|
|
64
64
|
.filter(validateAnnotationMark).forEach(function (m) {
|
|
65
65
|
return allAnnotationIds.add(m.attrs.id);
|
|
66
66
|
});
|
package/dist/esm/version.json
CHANGED
|
@@ -10,5 +10,6 @@ export declare const removeInlineCommentNearSelection: (id: string) => Command;
|
|
|
10
10
|
export declare const setInlineCommentDraftState: (drafting: boolean, inputMethod?: INPUT_METHOD.TOOLBAR | INPUT_METHOD.SHORTCUT) => Command;
|
|
11
11
|
export declare const addInlineComment: (id: string) => Command;
|
|
12
12
|
export declare const updateMouseState: (mouseData: InlineCommentMouseData) => Command;
|
|
13
|
+
export declare const setSelectedAnnotation: (id: string) => Command;
|
|
13
14
|
export declare const createAnnotation: (id: string, annotationType?: AnnotationTypes) => Command;
|
|
14
15
|
export declare const setInlineCommentsVisibility: (isVisible: boolean) => Command;
|
|
@@ -10,7 +10,8 @@ export declare enum ACTIONS {
|
|
|
10
10
|
INLINE_COMMENT_CLEAR_DIRTY_MARK = 3,
|
|
11
11
|
ADD_INLINE_COMMENT = 4,
|
|
12
12
|
INLINE_COMMENT_SET_VISIBLE = 5,
|
|
13
|
-
CLOSE_COMPONENT = 6
|
|
13
|
+
CLOSE_COMPONENT = 6,
|
|
14
|
+
SET_SELECTED_ANNOTATION = 7
|
|
14
15
|
}
|
|
15
16
|
export interface InlineCommentPluginOptions {
|
|
16
17
|
dispatch: Dispatch;
|
|
@@ -55,6 +56,11 @@ export type InlineCommentAction = {
|
|
|
55
56
|
data: {
|
|
56
57
|
isVisible: boolean;
|
|
57
58
|
};
|
|
59
|
+
} | {
|
|
60
|
+
type: ACTIONS.SET_SELECTED_ANNOTATION;
|
|
61
|
+
data: {
|
|
62
|
+
selectedAnnotations: AnnotationInfo[];
|
|
63
|
+
};
|
|
58
64
|
};
|
|
59
65
|
export type InlineCommentPluginState = {
|
|
60
66
|
annotations: InlineCommentMap;
|
|
@@ -39,6 +39,10 @@ export type InlineCommentViewComponentProps = AnnotationComponentProps & {
|
|
|
39
39
|
* Removes the annotation from the document
|
|
40
40
|
*/
|
|
41
41
|
onDelete?: (id: string) => void;
|
|
42
|
+
/**
|
|
43
|
+
* Ordered list of annotation ids as shown in the document
|
|
44
|
+
*/
|
|
45
|
+
annotationsList?: string[];
|
|
42
46
|
};
|
|
43
47
|
export interface AnnotationState<Type, State> {
|
|
44
48
|
annotationType: Type;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
|
-
export type UpdateEvent = 'create' | 'delete' | 'resolve' | 'unresolve';
|
|
3
|
+
export type UpdateEvent = 'create' | 'delete' | 'resolve' | 'unresolve' | 'setselectedannotation';
|
|
4
4
|
export type VisibilityEvent = 'setvisibility';
|
|
5
5
|
export declare class AnnotationUpdateEmitter extends EventEmitter {
|
|
6
6
|
on(event: VisibilityEvent, listener: (isVisible: boolean) => void): this;
|
|
@@ -10,5 +10,6 @@ export declare const removeInlineCommentNearSelection: (id: string) => Command;
|
|
|
10
10
|
export declare const setInlineCommentDraftState: (drafting: boolean, inputMethod?: INPUT_METHOD.TOOLBAR | INPUT_METHOD.SHORTCUT) => Command;
|
|
11
11
|
export declare const addInlineComment: (id: string) => Command;
|
|
12
12
|
export declare const updateMouseState: (mouseData: InlineCommentMouseData) => Command;
|
|
13
|
+
export declare const setSelectedAnnotation: (id: string) => Command;
|
|
13
14
|
export declare const createAnnotation: (id: string, annotationType?: AnnotationTypes) => Command;
|
|
14
15
|
export declare const setInlineCommentsVisibility: (isVisible: boolean) => Command;
|
|
@@ -10,7 +10,8 @@ export declare enum ACTIONS {
|
|
|
10
10
|
INLINE_COMMENT_CLEAR_DIRTY_MARK = 3,
|
|
11
11
|
ADD_INLINE_COMMENT = 4,
|
|
12
12
|
INLINE_COMMENT_SET_VISIBLE = 5,
|
|
13
|
-
CLOSE_COMPONENT = 6
|
|
13
|
+
CLOSE_COMPONENT = 6,
|
|
14
|
+
SET_SELECTED_ANNOTATION = 7
|
|
14
15
|
}
|
|
15
16
|
export interface InlineCommentPluginOptions {
|
|
16
17
|
dispatch: Dispatch;
|
|
@@ -55,6 +56,11 @@ export type InlineCommentAction = {
|
|
|
55
56
|
data: {
|
|
56
57
|
isVisible: boolean;
|
|
57
58
|
};
|
|
59
|
+
} | {
|
|
60
|
+
type: ACTIONS.SET_SELECTED_ANNOTATION;
|
|
61
|
+
data: {
|
|
62
|
+
selectedAnnotations: AnnotationInfo[];
|
|
63
|
+
};
|
|
58
64
|
};
|
|
59
65
|
export type InlineCommentPluginState = {
|
|
60
66
|
annotations: InlineCommentMap;
|
|
@@ -39,6 +39,10 @@ export type InlineCommentViewComponentProps = AnnotationComponentProps & {
|
|
|
39
39
|
* Removes the annotation from the document
|
|
40
40
|
*/
|
|
41
41
|
onDelete?: (id: string) => void;
|
|
42
|
+
/**
|
|
43
|
+
* Ordered list of annotation ids as shown in the document
|
|
44
|
+
*/
|
|
45
|
+
annotationsList?: string[];
|
|
42
46
|
};
|
|
43
47
|
export interface AnnotationState<Type, State> {
|
|
44
48
|
annotationType: Type;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
|
-
export type UpdateEvent = 'create' | 'delete' | 'resolve' | 'unresolve';
|
|
3
|
+
export type UpdateEvent = 'create' | 'delete' | 'resolve' | 'unresolve' | 'setselectedannotation';
|
|
4
4
|
export type VisibilityEvent = 'setvisibility';
|
|
5
5
|
export declare class AnnotationUpdateEmitter extends EventEmitter {
|
|
6
6
|
on(event: VisibilityEvent, listener: (isVisible: boolean) => void): this;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "187.
|
|
3
|
+
"version": "187.21.0",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -147,7 +147,7 @@
|
|
|
147
147
|
"@atlaskit/dropdown-menu": "^11.11.0",
|
|
148
148
|
"@atlaskit/editor-extension-dropbox": "^0.4.0",
|
|
149
149
|
"@atlaskit/editor-plugin-table": "^2.8.0",
|
|
150
|
-
"@atlaskit/editor-test-helpers": "^18.
|
|
150
|
+
"@atlaskit/editor-test-helpers": "^18.11.0",
|
|
151
151
|
"@atlaskit/flag": "^15.2.0",
|
|
152
152
|
"@atlaskit/icon-object": "^6.3.0",
|
|
153
153
|
"@atlaskit/inline-dialog": "^13.6.0",
|
package/report.api.md
CHANGED
|
@@ -1113,6 +1113,7 @@ export type InlineCommentViewComponentProps = AnnotationComponentProps & {
|
|
|
1113
1113
|
annotations: Array<AnnotationInfo>;
|
|
1114
1114
|
onResolve: (id: string) => void;
|
|
1115
1115
|
onDelete?: (id: string) => void;
|
|
1116
|
+
annotationsList?: string[];
|
|
1116
1117
|
};
|
|
1117
1118
|
|
|
1118
1119
|
export { INPUT_METHOD };
|
|
@@ -2181,7 +2182,12 @@ interface TypeAheadStatsSerializable extends TypeAheadStats {
|
|
|
2181
2182
|
}
|
|
2182
2183
|
|
|
2183
2184
|
// @public (undocumented)
|
|
2184
|
-
export type UpdateEvent =
|
|
2185
|
+
export type UpdateEvent =
|
|
2186
|
+
| 'create'
|
|
2187
|
+
| 'delete'
|
|
2188
|
+
| 'resolve'
|
|
2189
|
+
| 'setselectedannotation'
|
|
2190
|
+
| 'unresolve';
|
|
2185
2191
|
|
|
2186
2192
|
// @public (undocumented)
|
|
2187
2193
|
export const updateStatus: (status?: StatusType) => Command;
|
package/tmp/api-report-tmp.d.ts
CHANGED
|
@@ -1016,6 +1016,7 @@ export type InlineCommentViewComponentProps = AnnotationComponentProps & {
|
|
|
1016
1016
|
annotations: Array<AnnotationInfo>;
|
|
1017
1017
|
onResolve: (id: string) => void;
|
|
1018
1018
|
onDelete?: (id: string) => void;
|
|
1019
|
+
annotationsList?: string[];
|
|
1019
1020
|
};
|
|
1020
1021
|
|
|
1021
1022
|
export { INPUT_METHOD }
|
|
@@ -1941,7 +1942,7 @@ interface TypeAheadStatsSerializable extends TypeAheadStats {
|
|
|
1941
1942
|
}
|
|
1942
1943
|
|
|
1943
1944
|
// @public (undocumented)
|
|
1944
|
-
export type UpdateEvent = 'create' | 'delete' | 'resolve' | 'unresolve';
|
|
1945
|
+
export type UpdateEvent = 'create' | 'delete' | 'resolve' | 'setselectedannotation' | 'unresolve';
|
|
1945
1946
|
|
|
1946
1947
|
// @public (undocumented)
|
|
1947
1948
|
export const updateStatus: (status?: StatusType) => Command;
|