@atlaskit/editor-plugin-annotation 1.0.2 → 1.2.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 +12 -0
- package/dist/cjs/commands/index.js +7 -4
- package/dist/cjs/plugin.js +15 -11
- package/dist/cjs/pm-plugins/inline-comment.js +1 -4
- package/dist/cjs/pm-plugins/plugin-factory.js +1 -33
- package/dist/cjs/pm-plugins/reducer.js +6 -12
- package/dist/cjs/toolbar.js +7 -2
- package/dist/cjs/types.js +7 -0
- package/dist/cjs/ui/InlineCommentView.js +1 -2
- package/dist/cjs/utils.js +14 -1
- package/dist/es2019/commands/index.js +6 -5
- package/dist/es2019/plugin.js +15 -11
- package/dist/es2019/pm-plugins/inline-comment.js +1 -2
- package/dist/es2019/pm-plugins/plugin-factory.js +1 -33
- package/dist/es2019/pm-plugins/reducer.js +6 -15
- package/dist/es2019/toolbar.js +7 -3
- package/dist/es2019/types.js +9 -0
- package/dist/es2019/ui/InlineCommentView.js +1 -2
- package/dist/es2019/utils.js +14 -2
- package/dist/esm/commands/index.js +7 -4
- package/dist/esm/plugin.js +15 -11
- package/dist/esm/pm-plugins/inline-comment.js +1 -4
- package/dist/esm/pm-plugins/plugin-factory.js +1 -33
- package/dist/esm/pm-plugins/reducer.js +6 -12
- package/dist/esm/toolbar.js +7 -2
- package/dist/esm/types.js +9 -0
- package/dist/esm/ui/InlineCommentView.js +1 -2
- package/dist/esm/utils.js +14 -1
- package/dist/types/commands/index.d.ts +2 -3
- package/dist/types/commands/transform.d.ts +11 -4
- package/dist/types/index.d.ts +1 -1
- package/dist/types/pm-plugins/types.d.ts +2 -1
- package/dist/types/toolbar.d.ts +1 -1
- package/dist/types/types.d.ts +20 -2
- package/dist/types/utils.d.ts +5 -5
- package/dist/types-ts4.5/commands/index.d.ts +2 -3
- package/dist/types-ts4.5/commands/transform.d.ts +13 -4
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/types.d.ts +2 -1
- package/dist/types-ts4.5/toolbar.d.ts +1 -1
- package/dist/types-ts4.5/types.d.ts +20 -2
- package/dist/types-ts4.5/utils.d.ts +5 -5
- package/package.json +3 -5
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
2
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
3
2
|
import { addDraftDecoration } from '../utils';
|
|
4
3
|
import { ACTIONS } from './types';
|
|
5
4
|
export default ((pluginState, action) => {
|
|
@@ -19,7 +18,7 @@ export default ((pluginState, action) => {
|
|
|
19
18
|
mouseData
|
|
20
19
|
};
|
|
21
20
|
case ACTIONS.SET_INLINE_COMMENT_DRAFT_STATE:
|
|
22
|
-
return getNewDraftState(pluginState, action.data.drafting, action.data.editorState);
|
|
21
|
+
return getNewDraftState(pluginState, action.data.drafting, action.data.editorState, action.data.targetType);
|
|
23
22
|
case ACTIONS.INLINE_COMMENT_CLEAR_DIRTY_MARK:
|
|
24
23
|
return {
|
|
25
24
|
...pluginState,
|
|
@@ -27,12 +26,9 @@ export default ((pluginState, action) => {
|
|
|
27
26
|
annotations: {}
|
|
28
27
|
};
|
|
29
28
|
case ACTIONS.CLOSE_COMPONENT:
|
|
30
|
-
return
|
|
29
|
+
return {
|
|
31
30
|
...pluginState,
|
|
32
31
|
isInlineCommentViewClosed: true
|
|
33
|
-
} : {
|
|
34
|
-
...pluginState,
|
|
35
|
-
selectedAnnotations: []
|
|
36
32
|
};
|
|
37
33
|
case ACTIONS.ADD_INLINE_COMMENT:
|
|
38
34
|
const updatedPluginState = getNewDraftState(pluginState, action.data.drafting, action.data.editorState);
|
|
@@ -43,9 +39,7 @@ export default ((pluginState, action) => {
|
|
|
43
39
|
...pluginState.annotations,
|
|
44
40
|
...action.data.inlineComments
|
|
45
41
|
},
|
|
46
|
-
|
|
47
|
-
isInlineCommentViewClosed: false
|
|
48
|
-
})
|
|
42
|
+
isInlineCommentViewClosed: false
|
|
49
43
|
};
|
|
50
44
|
case ACTIONS.INLINE_COMMENT_SET_VISIBLE:
|
|
51
45
|
const {
|
|
@@ -63,16 +57,13 @@ export default ((pluginState, action) => {
|
|
|
63
57
|
...pluginState,
|
|
64
58
|
selectedAnnotations: [...action.data.selectedAnnotations],
|
|
65
59
|
skipSelectionHandling: true,
|
|
66
|
-
|
|
67
|
-
// if selecting annotation explicitly, reopen the comment view
|
|
68
|
-
isInlineCommentViewClosed: false
|
|
69
|
-
})
|
|
60
|
+
isInlineCommentViewClosed: false
|
|
70
61
|
};
|
|
71
62
|
default:
|
|
72
63
|
return pluginState;
|
|
73
64
|
}
|
|
74
65
|
});
|
|
75
|
-
function getNewDraftState(pluginState, drafting, editorState) {
|
|
66
|
+
function getNewDraftState(pluginState, drafting, editorState, targetType) {
|
|
76
67
|
let {
|
|
77
68
|
draftDecorationSet
|
|
78
69
|
} = pluginState;
|
|
@@ -87,7 +78,7 @@ function getNewDraftState(pluginState, drafting, editorState) {
|
|
|
87
78
|
if (drafting && editorState) {
|
|
88
79
|
newState.bookmark = editorState.selection.getBookmark();
|
|
89
80
|
const resolvedBookmark = newState.bookmark.resolve(editorState.doc);
|
|
90
|
-
const draftDecoration = addDraftDecoration(resolvedBookmark.from, resolvedBookmark.to);
|
|
81
|
+
const draftDecoration = addDraftDecoration(resolvedBookmark.from, resolvedBookmark.to, targetType);
|
|
91
82
|
newState.draftDecorationSet = draftDecorationSet.add(editorState.doc, [draftDecoration]);
|
|
92
83
|
}
|
|
93
84
|
return newState;
|
package/dist/es2019/toolbar.js
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import { addInlineComment, ToolTipContent } from '@atlaskit/editor-common/keymaps';
|
|
4
|
+
import { currentMediaNodeWithPos } from '@atlaskit/editor-common/media-single';
|
|
4
5
|
import { annotationMessages } from '@atlaskit/editor-common/messages';
|
|
5
6
|
import { calculateToolbarPositionAboveSelection, calculateToolbarPositionTrackHead } from '@atlaskit/editor-common/utils';
|
|
6
7
|
import CommentIcon from '@atlaskit/icon/glyph/comment';
|
|
7
8
|
import { setInlineCommentDraftState } from './commands';
|
|
8
9
|
import { AnnotationSelectionType, AnnotationTestIds } from './types';
|
|
9
10
|
import { isSelectionValid } from './utils';
|
|
10
|
-
export const buildToolbar = editorAnalyticsAPI => (state, intl, isToolbarAbove = false) => {
|
|
11
|
+
export const buildToolbar = editorAnalyticsAPI => (state, intl, isToolbarAbove = false, isCommentOnMediaOn) => {
|
|
11
12
|
const {
|
|
12
13
|
schema
|
|
13
14
|
} = state;
|
|
14
|
-
const selectionValid = isSelectionValid(state);
|
|
15
|
-
|
|
15
|
+
const selectionValid = isSelectionValid(state, isCommentOnMediaOn);
|
|
16
|
+
const isMediaSelected = isCommentOnMediaOn && currentMediaNodeWithPos(state);
|
|
17
|
+
|
|
18
|
+
// comments on media can only be added via media floating toolbar
|
|
19
|
+
if (isMediaSelected || selectionValid === AnnotationSelectionType.INVALID) {
|
|
16
20
|
return undefined;
|
|
17
21
|
}
|
|
18
22
|
const createCommentMessage = intl.formatMessage(annotationMessages.createComment);
|
package/dist/es2019/types.js
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* type of target that annotation apply to.
|
|
3
|
+
* This is used to apply correct decoration to a draft comment
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The source of draft comment being created
|
|
8
|
+
*/
|
|
9
|
+
|
|
1
10
|
export let AnnotationSelectionType = /*#__PURE__*/function (AnnotationSelectionType) {
|
|
2
11
|
AnnotationSelectionType["INVALID"] = "invalid";
|
|
3
12
|
AnnotationSelectionType["DISABLED"] = "disabled";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, CONTENT_COMPONENT, EVENT_TYPE, RESOLVE_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
4
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
5
4
|
import { closeComponent, createAnnotation, removeInlineCommentNearSelection, setInlineCommentDraftState, updateInlineCommentResolvedState } from '../commands';
|
|
6
5
|
import { AnnotationTestIds } from '../types';
|
|
7
6
|
import { getAllAnnotations, getAnnotationViewKey, getPluginState, getSelectionPositions } from '../utils';
|
|
@@ -123,7 +122,7 @@ export function InlineCommentView({
|
|
|
123
122
|
};
|
|
124
123
|
dispatchAnalyticsEvent(payload);
|
|
125
124
|
};
|
|
126
|
-
if (
|
|
125
|
+
if (isInlineCommentViewClosed || !selectedAnnotations) {
|
|
127
126
|
return null;
|
|
128
127
|
}
|
|
129
128
|
return /*#__PURE__*/React.createElement(AnnotationViewWrapper, {
|
package/dist/es2019/utils.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AnnotationTypes } from '@atlaskit/adf-schema';
|
|
2
2
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import { currentMediaNodeWithPos } from '@atlaskit/editor-common/media-single';
|
|
3
4
|
import { AnnotationSharedClassNames } from '@atlaskit/editor-common/styles';
|
|
4
5
|
import { canApplyAnnotationOnRange, containsAnyAnnotations, getAnnotationIdsFromRange, hasAnnotationMark, isParagraph, isText } from '@atlaskit/editor-common/utils';
|
|
5
6
|
import { AllSelection, PluginKey, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
@@ -91,7 +92,12 @@ const validateAnnotationMark = annotationMark => {
|
|
|
91
92
|
* add decoration for the comment selection in draft state
|
|
92
93
|
* (when creating new comment)
|
|
93
94
|
*/
|
|
94
|
-
export const addDraftDecoration = (start, end) => {
|
|
95
|
+
export const addDraftDecoration = (start, end, targetType = 'inline') => {
|
|
96
|
+
if (targetType === 'block') {
|
|
97
|
+
return Decoration.node(start, end, {
|
|
98
|
+
class: `${AnnotationSharedClassNames.draft}`
|
|
99
|
+
});
|
|
100
|
+
}
|
|
95
101
|
return Decoration.inline(start, end, {
|
|
96
102
|
class: `${AnnotationSharedClassNames.draft}`
|
|
97
103
|
});
|
|
@@ -188,13 +194,19 @@ export const getDraftCommandAnalyticsPayload = (drafting, inputMethod) => {
|
|
|
188
194
|
};
|
|
189
195
|
return payload;
|
|
190
196
|
};
|
|
191
|
-
export const isSelectionValid = state => {
|
|
197
|
+
export const isSelectionValid = (state, isCommentOnMediaOn) => {
|
|
198
|
+
var _currentMediaNodeWith;
|
|
192
199
|
const {
|
|
193
200
|
selection
|
|
194
201
|
} = state;
|
|
195
202
|
const {
|
|
196
203
|
disallowOnWhitespace
|
|
197
204
|
} = getPluginState(state) || {};
|
|
205
|
+
|
|
206
|
+
// Allow media so that it can enter draft mode
|
|
207
|
+
if (isCommentOnMediaOn && (_currentMediaNodeWith = currentMediaNodeWithPos(state)) !== null && _currentMediaNodeWith !== void 0 && _currentMediaNodeWith.node) {
|
|
208
|
+
return AnnotationSelectionType.VALID;
|
|
209
|
+
}
|
|
198
210
|
if (selection.empty || !(selection instanceof TextSelection || selection instanceof AllSelection)) {
|
|
199
211
|
return AnnotationSelectionType.INVALID;
|
|
200
212
|
}
|
|
@@ -54,17 +54,18 @@ export var removeInlineCommentNearSelection = function removeInlineCommentNearSe
|
|
|
54
54
|
return true;
|
|
55
55
|
};
|
|
56
56
|
};
|
|
57
|
-
var getDraftCommandAction = function getDraftCommandAction(drafting) {
|
|
57
|
+
var getDraftCommandAction = function getDraftCommandAction(drafting, targetType, isCommentOnMediaOn) {
|
|
58
58
|
return function (editorState) {
|
|
59
59
|
// validate selection only when entering draft mode
|
|
60
|
-
if (drafting && isSelectionValid(editorState) !== AnnotationSelectionType.VALID) {
|
|
60
|
+
if (drafting && isSelectionValid(editorState, isCommentOnMediaOn) !== AnnotationSelectionType.VALID) {
|
|
61
61
|
return false;
|
|
62
62
|
}
|
|
63
63
|
return {
|
|
64
64
|
type: ACTIONS.SET_INLINE_COMMENT_DRAFT_STATE,
|
|
65
65
|
data: {
|
|
66
66
|
drafting: drafting,
|
|
67
|
-
editorState: editorState
|
|
67
|
+
editorState: editorState,
|
|
68
|
+
targetType: targetType
|
|
68
69
|
}
|
|
69
70
|
};
|
|
70
71
|
};
|
|
@@ -72,7 +73,9 @@ var getDraftCommandAction = function getDraftCommandAction(drafting) {
|
|
|
72
73
|
export var setInlineCommentDraftState = function setInlineCommentDraftState(editorAnalyticsAPI) {
|
|
73
74
|
return function (drafting) {
|
|
74
75
|
var inputMethod = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : INPUT_METHOD.TOOLBAR;
|
|
75
|
-
var
|
|
76
|
+
var targetType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'inline';
|
|
77
|
+
var isCommentOnMediaOn = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
78
|
+
var commandAction = getDraftCommandAction(drafting, targetType, isCommentOnMediaOn);
|
|
76
79
|
return createCommand(commandAction, transform.addOpenCloseAnalytics(editorAnalyticsAPI)(drafting, inputMethod));
|
|
77
80
|
};
|
|
78
81
|
};
|
package/dist/esm/plugin.js
CHANGED
|
@@ -3,14 +3,17 @@ import { annotation } from '@atlaskit/adf-schema';
|
|
|
3
3
|
import { AnnotationUpdateEmitter } from '@atlaskit/editor-common/annotation';
|
|
4
4
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
5
5
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
6
|
+
import { setInlineCommentDraftState } from './commands';
|
|
6
7
|
import { inlineCommentPlugin } from './pm-plugins/inline-comment';
|
|
7
8
|
import { keymapPlugin } from './pm-plugins/keymap';
|
|
8
9
|
import { buildToolbar } from './toolbar';
|
|
9
10
|
import { InlineCommentView } from './ui/InlineCommentView';
|
|
10
11
|
import { getPluginState, stripNonExistingAnnotations } from './utils';
|
|
11
12
|
export var annotationPlugin = function annotationPlugin(_ref) {
|
|
13
|
+
var _api$featureFlags, _api$analytics;
|
|
12
14
|
var annotationProviders = _ref.config,
|
|
13
15
|
api = _ref.api;
|
|
16
|
+
var featureFlags = api === null || api === void 0 || (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState();
|
|
14
17
|
return {
|
|
15
18
|
name: 'annotation',
|
|
16
19
|
marks: function marks() {
|
|
@@ -20,7 +23,8 @@ export var annotationPlugin = function annotationPlugin(_ref) {
|
|
|
20
23
|
}];
|
|
21
24
|
},
|
|
22
25
|
actions: {
|
|
23
|
-
stripNonExistingAnnotations: stripNonExistingAnnotations
|
|
26
|
+
stripNonExistingAnnotations: stripNonExistingAnnotations,
|
|
27
|
+
setInlineCommentDraftState: setInlineCommentDraftState(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)
|
|
24
28
|
},
|
|
25
29
|
getSharedState: function getSharedState(editorState) {
|
|
26
30
|
if (!editorState) {
|
|
@@ -36,13 +40,13 @@ export var annotationPlugin = function annotationPlugin(_ref) {
|
|
|
36
40
|
portalProviderAPI = _ref2.portalProviderAPI,
|
|
37
41
|
eventDispatcher = _ref2.eventDispatcher;
|
|
38
42
|
if (annotationProviders) {
|
|
39
|
-
var _api$
|
|
43
|
+
var _api$analytics2;
|
|
40
44
|
return inlineCommentPlugin({
|
|
41
45
|
dispatch: dispatch,
|
|
42
46
|
portalProviderAPI: portalProviderAPI,
|
|
43
47
|
eventDispatcher: eventDispatcher,
|
|
44
48
|
provider: annotationProviders.inlineComment,
|
|
45
|
-
editorAnalyticsAPI: api === null || api === void 0 || (_api$
|
|
49
|
+
editorAnalyticsAPI: api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions
|
|
46
50
|
});
|
|
47
51
|
}
|
|
48
52
|
return;
|
|
@@ -51,8 +55,8 @@ export var annotationPlugin = function annotationPlugin(_ref) {
|
|
|
51
55
|
name: 'annotationKeymap',
|
|
52
56
|
plugin: function plugin() {
|
|
53
57
|
if (annotationProviders) {
|
|
54
|
-
var _api$
|
|
55
|
-
return keymapPlugin(api === null || api === void 0 || (_api$
|
|
58
|
+
var _api$analytics3;
|
|
59
|
+
return keymapPlugin(api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions);
|
|
56
60
|
}
|
|
57
61
|
return;
|
|
58
62
|
}
|
|
@@ -65,9 +69,9 @@ export var annotationPlugin = function annotationPlugin(_ref) {
|
|
|
65
69
|
}
|
|
66
70
|
var pluginState = getPluginState(state);
|
|
67
71
|
if (pluginState && pluginState.isVisible && !pluginState.bookmark && !pluginState.mouseData.isSelecting) {
|
|
68
|
-
var _api$
|
|
72
|
+
var _api$analytics4;
|
|
69
73
|
var isToolbarAbove = annotationProviders.inlineComment.isToolbarAbove;
|
|
70
|
-
return buildToolbar(api === null || api === void 0 || (_api$
|
|
74
|
+
return buildToolbar(api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions)(state, intl, isToolbarAbove, featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.commentsOnMedia);
|
|
71
75
|
}
|
|
72
76
|
},
|
|
73
77
|
selectionToolbar: function selectionToolbar(state, intl) {
|
|
@@ -76,9 +80,9 @@ export var annotationPlugin = function annotationPlugin(_ref) {
|
|
|
76
80
|
}
|
|
77
81
|
var pluginState = getPluginState(state);
|
|
78
82
|
if (pluginState && pluginState.isVisible && !pluginState.bookmark && !pluginState.mouseData.isSelecting) {
|
|
79
|
-
var _api$
|
|
83
|
+
var _api$analytics5;
|
|
80
84
|
var isToolbarAbove = annotationProviders.inlineComment.isToolbarAbove;
|
|
81
|
-
return buildToolbar(api === null || api === void 0 || (_api$
|
|
85
|
+
return buildToolbar(api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions)(state, intl, isToolbarAbove, featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.commentsOnMedia);
|
|
82
86
|
}
|
|
83
87
|
}
|
|
84
88
|
},
|
|
@@ -98,7 +102,7 @@ export var annotationPlugin = function annotationPlugin(_ref) {
|
|
|
98
102
|
};
|
|
99
103
|
};
|
|
100
104
|
function AnnotationContentComponent(_ref4) {
|
|
101
|
-
var _api$
|
|
105
|
+
var _api$analytics6;
|
|
102
106
|
var api = _ref4.api,
|
|
103
107
|
editorView = _ref4.editorView,
|
|
104
108
|
annotationProviders = _ref4.annotationProviders,
|
|
@@ -114,7 +118,7 @@ function AnnotationContentComponent(_ref4) {
|
|
|
114
118
|
providers: annotationProviders,
|
|
115
119
|
editorView: editorView,
|
|
116
120
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
117
|
-
editorAnalyticsAPI: api === null || api === void 0 || (_api$
|
|
121
|
+
editorAnalyticsAPI: api === null || api === void 0 || (_api$analytics6 = api.analytics) === null || _api$analytics6 === void 0 ? void 0 : _api$analytics6.actions,
|
|
118
122
|
editorAPI: api
|
|
119
123
|
}));
|
|
120
124
|
}
|
|
@@ -5,7 +5,6 @@ import { AnnotationTypes } from '@atlaskit/adf-schema';
|
|
|
5
5
|
import { RESOLVE_METHOD } from '@atlaskit/editor-common/analytics';
|
|
6
6
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
7
7
|
import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
8
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
9
8
|
import { clearDirtyMark, closeComponent, setInlineCommentsVisibility, setSelectedAnnotation, updateInlineCommentResolvedState, updateMouseState } from '../commands';
|
|
10
9
|
import { AnnotationNodeView, getAnnotationViewClassname } from '../nodeviews';
|
|
11
10
|
import { getAllAnnotations, getPluginState, inlineCommentPluginKey } from '../utils';
|
|
@@ -217,9 +216,7 @@ export var inlineCommentPlugin = function inlineCommentPlugin(options) {
|
|
|
217
216
|
node.marks.filter(function (mark) {
|
|
218
217
|
return mark.type === state.schema.marks.annotation;
|
|
219
218
|
}).forEach(function (mark) {
|
|
220
|
-
var isSelected =
|
|
221
|
-
return selectedAnnotation.id === mark.attrs.id;
|
|
222
|
-
})) : !!(selectedAnnotations !== null && selectedAnnotations !== void 0 && selectedAnnotations.some(function (selectedAnnotation) {
|
|
219
|
+
var isSelected = !isInlineCommentViewClosed && !!(selectedAnnotations !== null && selectedAnnotations !== void 0 && selectedAnnotations.some(function (selectedAnnotation) {
|
|
223
220
|
return selectedAnnotation.id === mark.attrs.id;
|
|
224
221
|
}));
|
|
225
222
|
var isUnresolved = !!annotations && annotations[mark.attrs.id] === false;
|
|
@@ -2,50 +2,18 @@ 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 { pluginFactory } from '@atlaskit/editor-common/utils';
|
|
5
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
6
5
|
import { findAnnotationsInSelection, inlineCommentPluginKey, isSelectedAnnotationsChanged } from '../utils';
|
|
7
6
|
import reducer from './reducer';
|
|
8
7
|
var handleDocChanged = function handleDocChanged(tr, prevPluginState) {
|
|
9
8
|
if (!tr.getMeta('replaceDocument')) {
|
|
10
|
-
return
|
|
9
|
+
return getSelectionChangedHandler(false)(tr, prevPluginState);
|
|
11
10
|
}
|
|
12
11
|
return _objectSpread(_objectSpread({}, prevPluginState), {}, {
|
|
13
12
|
dirtyAnnotations: true
|
|
14
13
|
});
|
|
15
14
|
};
|
|
16
|
-
var handleSelectionChanged = function handleSelectionChanged(tr, pluginState) {
|
|
17
|
-
if (pluginState.skipSelectionHandling) {
|
|
18
|
-
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
19
|
-
skipSelectionHandling: false
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
var selectedAnnotations = findAnnotationsInSelection(tr.selection, tr.doc);
|
|
23
|
-
var changed = selectedAnnotations.length !== pluginState.selectedAnnotations.length || selectedAnnotations.some(function (annotationInfo) {
|
|
24
|
-
return !pluginState.selectedAnnotations.some(function (aInfo) {
|
|
25
|
-
return aInfo.type === annotationInfo.id;
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
if (changed) {
|
|
29
|
-
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
30
|
-
selectedAnnotations: selectedAnnotations
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
return pluginState;
|
|
34
|
-
};
|
|
35
15
|
var getSelectionChangedHandler = function getSelectionChangedHandler(reopenCommentView) {
|
|
36
16
|
return function (tr, pluginState) {
|
|
37
|
-
/**
|
|
38
|
-
* If feature flag is **OFF** we want to keep the old behavior. Note that
|
|
39
|
-
* reopenCommentView is not relevant here when using old behaviour.
|
|
40
|
-
*
|
|
41
|
-
* Feature flag is evaluated here rather than directly in onSelectionChanged where it is assigned
|
|
42
|
-
* to prevent the plugin from setting up the handler before the feature flag is evaluated.
|
|
43
|
-
*
|
|
44
|
-
* This comment / logic can be cleaned up once the feature flag is removed.
|
|
45
|
-
*/
|
|
46
|
-
if (!getBooleanFF('platform.editor.annotation.decouple-inline-comment-closed_flmox')) {
|
|
47
|
-
return handleSelectionChanged(tr, pluginState);
|
|
48
|
-
}
|
|
49
17
|
if (pluginState.skipSelectionHandling) {
|
|
50
18
|
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
51
19
|
skipSelectionHandling: false
|
|
@@ -3,7 +3,6 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
3
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
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
5
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
6
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
7
6
|
import { addDraftDecoration } from '../utils';
|
|
8
7
|
import { ACTIONS } from './types';
|
|
9
8
|
export default (function (pluginState, action) {
|
|
@@ -18,24 +17,21 @@ export default (function (pluginState, action) {
|
|
|
18
17
|
mouseData: mouseData
|
|
19
18
|
});
|
|
20
19
|
case ACTIONS.SET_INLINE_COMMENT_DRAFT_STATE:
|
|
21
|
-
return getNewDraftState(pluginState, action.data.drafting, action.data.editorState);
|
|
20
|
+
return getNewDraftState(pluginState, action.data.drafting, action.data.editorState, action.data.targetType);
|
|
22
21
|
case ACTIONS.INLINE_COMMENT_CLEAR_DIRTY_MARK:
|
|
23
22
|
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
24
23
|
dirtyAnnotations: false,
|
|
25
24
|
annotations: {}
|
|
26
25
|
});
|
|
27
26
|
case ACTIONS.CLOSE_COMPONENT:
|
|
28
|
-
return
|
|
27
|
+
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
29
28
|
isInlineCommentViewClosed: true
|
|
30
|
-
}) : _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
31
|
-
selectedAnnotations: []
|
|
32
29
|
});
|
|
33
30
|
case ACTIONS.ADD_INLINE_COMMENT:
|
|
34
31
|
var updatedPluginState = getNewDraftState(pluginState, action.data.drafting, action.data.editorState);
|
|
35
32
|
return _objectSpread(_objectSpread({}, updatedPluginState), {}, {
|
|
36
33
|
selectedAnnotations: [].concat(_toConsumableArray(updatedPluginState.selectedAnnotations), _toConsumableArray(action.data.selectedAnnotations)),
|
|
37
|
-
annotations: _objectSpread(_objectSpread({}, pluginState.annotations), action.data.inlineComments)
|
|
38
|
-
}, getBooleanFF('platform.editor.annotation.decouple-inline-comment-closed_flmox') && {
|
|
34
|
+
annotations: _objectSpread(_objectSpread({}, pluginState.annotations), action.data.inlineComments),
|
|
39
35
|
isInlineCommentViewClosed: false
|
|
40
36
|
});
|
|
41
37
|
case ACTIONS.INLINE_COMMENT_SET_VISIBLE:
|
|
@@ -49,16 +45,14 @@ export default (function (pluginState, action) {
|
|
|
49
45
|
case ACTIONS.SET_SELECTED_ANNOTATION:
|
|
50
46
|
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
51
47
|
selectedAnnotations: _toConsumableArray(action.data.selectedAnnotations),
|
|
52
|
-
skipSelectionHandling: true
|
|
53
|
-
}, getBooleanFF('platform.editor.annotation.decouple-inline-comment-closed_flmox') && {
|
|
54
|
-
// if selecting annotation explicitly, reopen the comment view
|
|
48
|
+
skipSelectionHandling: true,
|
|
55
49
|
isInlineCommentViewClosed: false
|
|
56
50
|
});
|
|
57
51
|
default:
|
|
58
52
|
return pluginState;
|
|
59
53
|
}
|
|
60
54
|
});
|
|
61
|
-
function getNewDraftState(pluginState, drafting, editorState) {
|
|
55
|
+
function getNewDraftState(pluginState, drafting, editorState, targetType) {
|
|
62
56
|
var draftDecorationSet = pluginState.draftDecorationSet;
|
|
63
57
|
if (!draftDecorationSet || !drafting) {
|
|
64
58
|
draftDecorationSet = DecorationSet.empty;
|
|
@@ -70,7 +64,7 @@ function getNewDraftState(pluginState, drafting, editorState) {
|
|
|
70
64
|
if (drafting && editorState) {
|
|
71
65
|
newState.bookmark = editorState.selection.getBookmark();
|
|
72
66
|
var resolvedBookmark = newState.bookmark.resolve(editorState.doc);
|
|
73
|
-
var draftDecoration = addDraftDecoration(resolvedBookmark.from, resolvedBookmark.to);
|
|
67
|
+
var draftDecoration = addDraftDecoration(resolvedBookmark.from, resolvedBookmark.to, targetType);
|
|
74
68
|
newState.draftDecorationSet = draftDecorationSet.add(editorState.doc, [draftDecoration]);
|
|
75
69
|
}
|
|
76
70
|
return newState;
|
package/dist/esm/toolbar.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import { addInlineComment, ToolTipContent } from '@atlaskit/editor-common/keymaps';
|
|
4
|
+
import { currentMediaNodeWithPos } from '@atlaskit/editor-common/media-single';
|
|
4
5
|
import { annotationMessages } from '@atlaskit/editor-common/messages';
|
|
5
6
|
import { calculateToolbarPositionAboveSelection, calculateToolbarPositionTrackHead } from '@atlaskit/editor-common/utils';
|
|
6
7
|
import CommentIcon from '@atlaskit/icon/glyph/comment';
|
|
@@ -10,9 +11,13 @@ import { isSelectionValid } from './utils';
|
|
|
10
11
|
export var buildToolbar = function buildToolbar(editorAnalyticsAPI) {
|
|
11
12
|
return function (state, intl) {
|
|
12
13
|
var isToolbarAbove = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
14
|
+
var isCommentOnMediaOn = arguments.length > 3 ? arguments[3] : undefined;
|
|
13
15
|
var schema = state.schema;
|
|
14
|
-
var selectionValid = isSelectionValid(state);
|
|
15
|
-
|
|
16
|
+
var selectionValid = isSelectionValid(state, isCommentOnMediaOn);
|
|
17
|
+
var isMediaSelected = isCommentOnMediaOn && currentMediaNodeWithPos(state);
|
|
18
|
+
|
|
19
|
+
// comments on media can only be added via media floating toolbar
|
|
20
|
+
if (isMediaSelected || selectionValid === AnnotationSelectionType.INVALID) {
|
|
16
21
|
return undefined;
|
|
17
22
|
}
|
|
18
23
|
var createCommentMessage = intl.formatMessage(annotationMessages.createComment);
|
package/dist/esm/types.js
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* type of target that annotation apply to.
|
|
3
|
+
* This is used to apply correct decoration to a draft comment
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The source of draft comment being created
|
|
8
|
+
*/
|
|
9
|
+
|
|
1
10
|
export var AnnotationSelectionType = /*#__PURE__*/function (AnnotationSelectionType) {
|
|
2
11
|
AnnotationSelectionType["INVALID"] = "invalid";
|
|
3
12
|
AnnotationSelectionType["DISABLED"] = "disabled";
|
|
@@ -2,7 +2,6 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, CONTENT_COMPONENT, EVENT_TYPE, RESOLVE_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
5
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
6
5
|
import { closeComponent, createAnnotation, removeInlineCommentNearSelection, setInlineCommentDraftState, updateInlineCommentResolvedState } from '../commands';
|
|
7
6
|
import { AnnotationTestIds } from '../types';
|
|
8
7
|
import { getAllAnnotations, getAnnotationViewKey, getPluginState, getSelectionPositions } from '../utils';
|
|
@@ -118,7 +117,7 @@ export function InlineCommentView(_ref) {
|
|
|
118
117
|
};
|
|
119
118
|
dispatchAnalyticsEvent(payload);
|
|
120
119
|
};
|
|
121
|
-
if (
|
|
120
|
+
if (isInlineCommentViewClosed || !selectedAnnotations) {
|
|
122
121
|
return null;
|
|
123
122
|
}
|
|
124
123
|
return /*#__PURE__*/React.createElement(AnnotationViewWrapper, {
|
package/dist/esm/utils.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AnnotationTypes } from '@atlaskit/adf-schema';
|
|
2
2
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import { currentMediaNodeWithPos } from '@atlaskit/editor-common/media-single';
|
|
3
4
|
import { AnnotationSharedClassNames } from '@atlaskit/editor-common/styles';
|
|
4
5
|
import { canApplyAnnotationOnRange, containsAnyAnnotations, getAnnotationIdsFromRange, hasAnnotationMark, isParagraph, isText } from '@atlaskit/editor-common/utils';
|
|
5
6
|
import { AllSelection, PluginKey, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
@@ -103,6 +104,12 @@ var validateAnnotationMark = function validateAnnotationMark(annotationMark) {
|
|
|
103
104
|
* (when creating new comment)
|
|
104
105
|
*/
|
|
105
106
|
export var addDraftDecoration = function addDraftDecoration(start, end) {
|
|
107
|
+
var targetType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'inline';
|
|
108
|
+
if (targetType === 'block') {
|
|
109
|
+
return Decoration.node(start, end, {
|
|
110
|
+
class: "".concat(AnnotationSharedClassNames.draft)
|
|
111
|
+
});
|
|
112
|
+
}
|
|
106
113
|
return Decoration.inline(start, end, {
|
|
107
114
|
class: "".concat(AnnotationSharedClassNames.draft)
|
|
108
115
|
});
|
|
@@ -201,10 +208,16 @@ export var getDraftCommandAnalyticsPayload = function getDraftCommandAnalyticsPa
|
|
|
201
208
|
};
|
|
202
209
|
return payload;
|
|
203
210
|
};
|
|
204
|
-
export var isSelectionValid = function isSelectionValid(state) {
|
|
211
|
+
export var isSelectionValid = function isSelectionValid(state, isCommentOnMediaOn) {
|
|
212
|
+
var _currentMediaNodeWith;
|
|
205
213
|
var selection = state.selection;
|
|
206
214
|
var _ref3 = getPluginState(state) || {},
|
|
207
215
|
disallowOnWhitespace = _ref3.disallowOnWhitespace;
|
|
216
|
+
|
|
217
|
+
// Allow media so that it can enter draft mode
|
|
218
|
+
if (isCommentOnMediaOn && (_currentMediaNodeWith = currentMediaNodeWithPos(state)) !== null && _currentMediaNodeWith !== void 0 && _currentMediaNodeWith.node) {
|
|
219
|
+
return AnnotationSelectionType.VALID;
|
|
220
|
+
}
|
|
208
221
|
if (selection.empty || !(selection instanceof TextSelection || selection instanceof AllSelection)) {
|
|
209
222
|
return AnnotationSelectionType.INVALID;
|
|
210
223
|
}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { AnnotationTypes } from '@atlaskit/adf-schema';
|
|
2
2
|
import type { EditorAnalyticsAPI, RESOLVE_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
3
|
import type { Command, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
5
4
|
import type { InlineCommentMap, InlineCommentMouseData } from '../pm-plugins/types';
|
|
6
|
-
import type { AnnotationPlugin } from '../types';
|
|
5
|
+
import type { AnnotationPlugin, InlineCommentInputMethod, TargetType } from '../types';
|
|
7
6
|
export declare const updateInlineCommentResolvedState: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (partialNewState: InlineCommentMap, resolveMethod?: RESOLVE_METHOD) => Command;
|
|
8
7
|
export declare const closeComponent: () => Command;
|
|
9
8
|
export declare const clearDirtyMark: () => Command;
|
|
10
9
|
export declare const removeInlineCommentNearSelection: (id: string) => Command;
|
|
11
|
-
export declare const setInlineCommentDraftState: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (drafting: boolean, inputMethod?:
|
|
10
|
+
export declare const setInlineCommentDraftState: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (drafting: boolean, inputMethod?: InlineCommentInputMethod, targetType?: TargetType, isCommentOnMediaOn?: boolean) => Command;
|
|
12
11
|
export declare const addInlineComment: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, editorAPI?: ExtractInjectionAPI<AnnotationPlugin> | undefined) => (id: string) => Command;
|
|
13
12
|
export declare const updateMouseState: (mouseData: InlineCommentMouseData) => Command;
|
|
14
13
|
export declare const setSelectedAnnotation: (id: string) => Command;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
1
|
import type { EditorAnalyticsAPI, RESOLVE_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
2
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
import type { InlineCommentInputMethod } from '../types';
|
|
4
4
|
declare const _default: {
|
|
5
5
|
addAnnotationMark: (id: string) => (transaction: Transaction, state: EditorState) => Transaction;
|
|
6
6
|
addInlineComment: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, editorAPI: import("@atlaskit/editor-common/types").PublicPluginAPI<[import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"annotation", {
|
|
@@ -62,9 +62,13 @@ declare const _default: {
|
|
|
62
62
|
};
|
|
63
63
|
}, {
|
|
64
64
|
mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
|
|
65
|
-
} | undefined
|
|
65
|
+
} | undefined>>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
|
|
66
|
+
pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
67
|
+
sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
68
|
+
}, import("@atlaskit/editor-common/types").FeatureFlags>>];
|
|
66
69
|
actions: {
|
|
67
70
|
stripNonExistingAnnotations: (slice: import("prosemirror-model").Slice, state: EditorState) => boolean | undefined;
|
|
71
|
+
setInlineCommentDraftState: (drafting: boolean, inputMethod: InlineCommentInputMethod, targetType?: import("../types").TargetType | undefined, isCommentOnMediaOn?: boolean | undefined) => import("@atlaskit/editor-common/types").Command;
|
|
68
72
|
};
|
|
69
73
|
}, import("../types").AnnotationProviders | undefined>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
|
|
70
74
|
pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
|
|
@@ -122,8 +126,11 @@ declare const _default: {
|
|
|
122
126
|
};
|
|
123
127
|
}, {
|
|
124
128
|
mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
|
|
125
|
-
} | undefined
|
|
126
|
-
|
|
129
|
+
} | undefined>>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
|
|
130
|
+
pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
131
|
+
sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
132
|
+
}, import("@atlaskit/editor-common/types").FeatureFlags>>]> | undefined) => (id: string) => (transaction: Transaction, state: EditorState) => Transaction;
|
|
133
|
+
addOpenCloseAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (drafting: boolean, method?: InlineCommentInputMethod) => (transaction: Transaction, state: EditorState) => Transaction;
|
|
127
134
|
addInsertAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (transaction: Transaction, state: EditorState) => Transaction;
|
|
128
135
|
addResolveAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (method?: RESOLVE_METHOD | undefined) => (transaction: Transaction, state: EditorState) => Transaction;
|
|
129
136
|
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { annotationPlugin } from './plugin';
|
|
2
|
-
export type { AnnotationPlugin, AnnotationProviders, InlineCommentAnnotationProvider, AnnotationInfo, InlineCommentCreateComponentProps, InlineCommentViewComponentProps, AnnotationState, AnnotationTypeProvider, InlineCommentState, } from './types';
|
|
2
|
+
export type { AnnotationPlugin, AnnotationProviders, InlineCommentAnnotationProvider, AnnotationInfo, InlineCommentCreateComponentProps, InlineCommentViewComponentProps, AnnotationState, AnnotationTypeProvider, InlineCommentState, TargetType, InlineCommentInputMethod, } from './types';
|
|
3
3
|
export type { InlineCommentMap, InlineCommentPluginState, InlineCommentPluginOptions, InlineCommentAction, } from './pm-plugins/types';
|
|
@@ -3,7 +3,7 @@ import type { Dispatch, EventDispatcher } from '@atlaskit/editor-common/event-di
|
|
|
3
3
|
import type { PortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
|
|
4
4
|
import type { EditorState, SelectionBookmark } from '@atlaskit/editor-prosemirror/state';
|
|
5
5
|
import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
6
|
-
import type { AnnotationInfo, InlineCommentAnnotationProvider } from '../types';
|
|
6
|
+
import type { AnnotationInfo, InlineCommentAnnotationProvider, TargetType } from '../types';
|
|
7
7
|
export declare enum ACTIONS {
|
|
8
8
|
UPDATE_INLINE_COMMENT_STATE = 0,
|
|
9
9
|
SET_INLINE_COMMENT_DRAFT_STATE = 1,
|
|
@@ -35,6 +35,7 @@ export type InlineCommentAction = {
|
|
|
35
35
|
data: {
|
|
36
36
|
drafting: boolean;
|
|
37
37
|
editorState: EditorState;
|
|
38
|
+
targetType?: TargetType;
|
|
38
39
|
};
|
|
39
40
|
} | {
|
|
40
41
|
type: ACTIONS.INLINE_COMMENT_UPDATE_MOUSE_STATE;
|
package/dist/types/toolbar.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ import type { IntlShape } from 'react-intl-next';
|
|
|
2
2
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import type { FloatingToolbarConfig } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
-
export declare const buildToolbar: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (state: EditorState, intl: IntlShape, isToolbarAbove?: boolean) => FloatingToolbarConfig | undefined;
|
|
5
|
+
export declare const buildToolbar: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (state: EditorState, intl: IntlShape, isToolbarAbove?: boolean, isCommentOnMediaOn?: boolean) => FloatingToolbarConfig | undefined;
|