@atlaskit/editor-plugin-annotation 1.2.2 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/cjs/commands/index.js +6 -3
- package/dist/cjs/plugin.js +7 -3
- package/dist/cjs/pm-plugins/inline-comment.js +6 -3
- package/dist/cjs/pm-plugins/plugin-factory.js +21 -3
- package/dist/cjs/pm-plugins/reducer.js +6 -4
- package/dist/cjs/utils.js +46 -5
- package/dist/es2019/commands/index.js +6 -4
- package/dist/es2019/plugin.js +7 -3
- package/dist/es2019/pm-plugins/inline-comment.js +6 -4
- package/dist/es2019/pm-plugins/plugin-factory.js +21 -4
- package/dist/es2019/pm-plugins/reducer.js +8 -5
- package/dist/es2019/utils.js +49 -5
- package/dist/esm/commands/index.js +6 -3
- package/dist/esm/plugin.js +7 -3
- package/dist/esm/pm-plugins/inline-comment.js +6 -3
- package/dist/esm/pm-plugins/plugin-factory.js +22 -4
- package/dist/esm/pm-plugins/reducer.js +7 -5
- package/dist/esm/utils.js +46 -5
- package/dist/types/commands/index.d.ts +1 -1
- package/dist/types/pm-plugins/types.d.ts +5 -0
- package/dist/types/types.d.ts +5 -0
- package/dist/types/utils.d.ts +7 -2
- package/dist/types-ts4.5/commands/index.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/types.d.ts +5 -0
- package/dist/types-ts4.5/types.d.ts +5 -0
- package/dist/types-ts4.5/utils.d.ts +7 -2
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-annotation
|
|
2
2
|
|
|
3
|
+
## 1.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#80679](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/80679) [`104eb9443b7e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/104eb9443b7e) - ED-22553 Updating adf-schema version to 35.6.0
|
|
8
|
+
|
|
9
|
+
## 1.3.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#80123](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/80123) [`8bb18b4d686c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8bb18b4d686c) - [ux] - Add decoration to media node when there is active draft comment associated, update plugin state mapping so that create view component is removed when there's node changes invalidating the decoration
|
|
14
|
+
|
|
15
|
+
- Save featureFlags plugin state as one of the annotation plugin state
|
|
16
|
+
|
|
3
17
|
## 1.2.2
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -100,7 +100,7 @@ var removeInlineCommentNearSelection = exports.removeInlineCommentNearSelection
|
|
|
100
100
|
return true;
|
|
101
101
|
};
|
|
102
102
|
};
|
|
103
|
-
var getDraftCommandAction = function getDraftCommandAction(drafting, targetType, isCommentOnMediaOn) {
|
|
103
|
+
var getDraftCommandAction = function getDraftCommandAction(drafting, targetType, isCommentOnMediaOn, supportedBlockNodes) {
|
|
104
104
|
return function (editorState) {
|
|
105
105
|
// validate selection only when entering draft mode
|
|
106
106
|
if (drafting && (0, _utils.isSelectionValid)(editorState, isCommentOnMediaOn) !== _types2.AnnotationSelectionType.VALID) {
|
|
@@ -111,17 +111,20 @@ var getDraftCommandAction = function getDraftCommandAction(drafting, targetType,
|
|
|
111
111
|
data: {
|
|
112
112
|
drafting: drafting,
|
|
113
113
|
editorState: editorState,
|
|
114
|
-
targetType: targetType
|
|
114
|
+
targetType: targetType,
|
|
115
|
+
isCommentOnMediaOn: isCommentOnMediaOn,
|
|
116
|
+
supportedBlockNodes: supportedBlockNodes
|
|
115
117
|
}
|
|
116
118
|
};
|
|
117
119
|
};
|
|
118
120
|
};
|
|
119
121
|
var setInlineCommentDraftState = exports.setInlineCommentDraftState = function setInlineCommentDraftState(editorAnalyticsAPI) {
|
|
122
|
+
var supportedBlockNodes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
120
123
|
return function (drafting) {
|
|
121
124
|
var inputMethod = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _analytics.INPUT_METHOD.TOOLBAR;
|
|
122
125
|
var targetType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'inline';
|
|
123
126
|
var isCommentOnMediaOn = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
124
|
-
var commandAction = getDraftCommandAction(drafting, targetType, isCommentOnMediaOn);
|
|
127
|
+
var commandAction = getDraftCommandAction(drafting, targetType, isCommentOnMediaOn, supportedBlockNodes);
|
|
125
128
|
return (0, _pluginFactory.createCommand)(commandAction, _transform.default.addOpenCloseAnalytics(editorAnalyticsAPI)(drafting, inputMethod));
|
|
126
129
|
};
|
|
127
130
|
};
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -37,13 +37,16 @@ var annotationPlugin = exports.annotationPlugin = function annotationPlugin(_ref
|
|
|
37
37
|
},
|
|
38
38
|
actions: {
|
|
39
39
|
stripNonExistingAnnotations: _utils.stripNonExistingAnnotations,
|
|
40
|
-
setInlineCommentDraftState: (0, _commands.setInlineCommentDraftState)(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)
|
|
40
|
+
setInlineCommentDraftState: (0, _commands.setInlineCommentDraftState)(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.supportedBlockNodes)
|
|
41
41
|
},
|
|
42
42
|
getSharedState: function getSharedState(editorState) {
|
|
43
43
|
if (!editorState) {
|
|
44
44
|
return undefined;
|
|
45
45
|
}
|
|
46
|
-
|
|
46
|
+
var pluginState = (0, _utils.getPluginState)(editorState) || undefined;
|
|
47
|
+
var clonedPluginState = Object.assign({}, pluginState);
|
|
48
|
+
clonedPluginState === null || clonedPluginState === void 0 || delete clonedPluginState.featureFlagsPluginState;
|
|
49
|
+
return clonedPluginState;
|
|
47
50
|
},
|
|
48
51
|
pmPlugins: function pmPlugins() {
|
|
49
52
|
return [{
|
|
@@ -59,7 +62,8 @@ var annotationPlugin = exports.annotationPlugin = function annotationPlugin(_ref
|
|
|
59
62
|
portalProviderAPI: portalProviderAPI,
|
|
60
63
|
eventDispatcher: eventDispatcher,
|
|
61
64
|
provider: annotationProviders.inlineComment,
|
|
62
|
-
editorAnalyticsAPI: api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions
|
|
65
|
+
editorAnalyticsAPI: api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions,
|
|
66
|
+
featureFlagsPluginState: featureFlags
|
|
63
67
|
});
|
|
64
68
|
}
|
|
65
69
|
return;
|
|
@@ -77,6 +77,7 @@ var fetchState = /*#__PURE__*/function () {
|
|
|
77
77
|
}();
|
|
78
78
|
var initialState = function initialState() {
|
|
79
79
|
var disallowOnWhitespace = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
80
|
+
var featureFlagsPluginState = arguments.length > 1 ? arguments[1] : undefined;
|
|
80
81
|
return {
|
|
81
82
|
annotations: {},
|
|
82
83
|
selectedAnnotations: [],
|
|
@@ -86,7 +87,8 @@ var initialState = function initialState() {
|
|
|
86
87
|
disallowOnWhitespace: disallowOnWhitespace,
|
|
87
88
|
isInlineCommentViewClosed: false,
|
|
88
89
|
isVisible: true,
|
|
89
|
-
skipSelectionHandling: false
|
|
90
|
+
skipSelectionHandling: false,
|
|
91
|
+
featureFlagsPluginState: featureFlagsPluginState
|
|
90
92
|
};
|
|
91
93
|
};
|
|
92
94
|
var hideToolbar = function hideToolbar(state, dispatch) {
|
|
@@ -140,10 +142,11 @@ var onSetVisibility = function onSetVisibility(view) {
|
|
|
140
142
|
var inlineCommentPlugin = exports.inlineCommentPlugin = function inlineCommentPlugin(options) {
|
|
141
143
|
var provider = options.provider,
|
|
142
144
|
portalProviderAPI = options.portalProviderAPI,
|
|
143
|
-
eventDispatcher = options.eventDispatcher
|
|
145
|
+
eventDispatcher = options.eventDispatcher,
|
|
146
|
+
featureFlagsPluginState = options.featureFlagsPluginState;
|
|
144
147
|
return new _safePlugin.SafePlugin({
|
|
145
148
|
key: _utils.inlineCommentPluginKey,
|
|
146
|
-
state: (0, _pluginFactory.createPluginState)(options.dispatch, initialState(provider.disallowOnWhitespace)),
|
|
149
|
+
state: (0, _pluginFactory.createPluginState)(options.dispatch, initialState(provider.disallowOnWhitespace, featureFlagsPluginState)),
|
|
147
150
|
view: function view(editorView) {
|
|
148
151
|
// Get initial state
|
|
149
152
|
// Need to pass `editorView` to mitigate editor state going stale
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.createPluginState = exports.createCommand = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
10
|
+
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
10
11
|
var _utils2 = require("../utils");
|
|
11
12
|
var _reducer = _interopRequireDefault(require("./reducer"));
|
|
12
13
|
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; }
|
|
@@ -50,13 +51,30 @@ var getSelectionChangedHandler = function getSelectionChangedHandler(reopenComme
|
|
|
50
51
|
var _pluginFactory = (0, _utils.pluginFactory)(_utils2.inlineCommentPluginKey, _reducer.default, {
|
|
51
52
|
onSelectionChanged: getSelectionChangedHandler(true),
|
|
52
53
|
onDocChanged: handleDocChanged,
|
|
53
|
-
mapping: function mapping(tr, pluginState) {
|
|
54
|
+
mapping: function mapping(tr, pluginState, editorState) {
|
|
54
55
|
var draftDecorationSet = pluginState.draftDecorationSet,
|
|
55
|
-
bookmark = pluginState.bookmark
|
|
56
|
-
|
|
56
|
+
bookmark = pluginState.bookmark,
|
|
57
|
+
featureFlagsPluginState = pluginState.featureFlagsPluginState;
|
|
58
|
+
var mappedDecorationSet = _view.DecorationSet.empty,
|
|
59
|
+
mappedBookmark;
|
|
60
|
+
var hasMappedDecorations = false;
|
|
57
61
|
if (draftDecorationSet) {
|
|
58
62
|
mappedDecorationSet = draftDecorationSet.map(tr.mapping, tr.doc);
|
|
59
63
|
}
|
|
64
|
+
if (featureFlagsPluginState !== null && featureFlagsPluginState !== void 0 && featureFlagsPluginState.commentsOnMedia) {
|
|
65
|
+
hasMappedDecorations = mappedDecorationSet.find(undefined, undefined, function (spec) {
|
|
66
|
+
return Object.values(_utils2.decorationKey).includes(spec.key);
|
|
67
|
+
}).length > 0;
|
|
68
|
+
|
|
69
|
+
// When changes to decoration target make decoration invalid (e.g. delete text, add mark to node),
|
|
70
|
+
// we need to reset bookmark to hide create component and to avoid invalid draft being published
|
|
71
|
+
if (!hasMappedDecorations) {
|
|
72
|
+
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
73
|
+
draftDecorationSet: mappedDecorationSet,
|
|
74
|
+
bookmark: undefined
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
60
78
|
if (bookmark) {
|
|
61
79
|
mappedBookmark = bookmark.map(tr.mapping);
|
|
62
80
|
}
|
|
@@ -24,7 +24,7 @@ var _default = exports.default = function _default(pluginState, action) {
|
|
|
24
24
|
mouseData: mouseData
|
|
25
25
|
});
|
|
26
26
|
case _types.ACTIONS.SET_INLINE_COMMENT_DRAFT_STATE:
|
|
27
|
-
return getNewDraftState(pluginState, action.data.drafting, action.data.editorState, action.data.targetType);
|
|
27
|
+
return getNewDraftState(pluginState, action.data.drafting, action.data.editorState, action.data.targetType, action.data.isCommentOnMediaOn, action.data.supportedBlockNodes);
|
|
28
28
|
case _types.ACTIONS.INLINE_COMMENT_CLEAR_DIRTY_MARK:
|
|
29
29
|
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
30
30
|
dirtyAnnotations: false,
|
|
@@ -59,7 +59,7 @@ var _default = exports.default = function _default(pluginState, action) {
|
|
|
59
59
|
return pluginState;
|
|
60
60
|
}
|
|
61
61
|
};
|
|
62
|
-
function getNewDraftState(pluginState, drafting, editorState, targetType) {
|
|
62
|
+
function getNewDraftState(pluginState, drafting, editorState, targetType, isCommentOnMediaOn, supportedBlockNodes) {
|
|
63
63
|
var draftDecorationSet = pluginState.draftDecorationSet;
|
|
64
64
|
if (!draftDecorationSet || !drafting) {
|
|
65
65
|
draftDecorationSet = _view.DecorationSet.empty;
|
|
@@ -70,8 +70,10 @@ function getNewDraftState(pluginState, drafting, editorState, targetType) {
|
|
|
70
70
|
newState.bookmark = undefined;
|
|
71
71
|
if (drafting && editorState) {
|
|
72
72
|
newState.bookmark = editorState.selection.getBookmark();
|
|
73
|
-
var
|
|
74
|
-
|
|
73
|
+
var _ref = isCommentOnMediaOn ? (0, _utils.resolveDraftBookmark)(editorState, newState.bookmark, supportedBlockNodes) : newState.bookmark.resolve(editorState.doc),
|
|
74
|
+
from = _ref.from,
|
|
75
|
+
to = _ref.to;
|
|
76
|
+
var draftDecoration = (0, _utils.addDraftDecoration)(from, to, targetType);
|
|
75
77
|
newState.draftDecorationSet = draftDecorationSet.add(editorState.doc, [draftDecoration]);
|
|
76
78
|
}
|
|
77
79
|
return newState;
|
package/dist/cjs/utils.js
CHANGED
|
@@ -11,7 +11,7 @@ Object.defineProperty(exports, "containsAnyAnnotations", {
|
|
|
11
11
|
return _utils.containsAnyAnnotations;
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
|
-
exports.getPluginState = exports.getDraftCommandAnalyticsPayload = exports.getAnnotationViewKey = exports.getAllAnnotations = exports.findAnnotationsInSelection = void 0;
|
|
14
|
+
exports.getPluginState = exports.getDraftCommandAnalyticsPayload = exports.getAnnotationViewKey = exports.getAllAnnotations = exports.findAnnotationsInSelection = exports.decorationKey = void 0;
|
|
15
15
|
exports.getSelectionPositions = getSelectionPositions;
|
|
16
16
|
Object.defineProperty(exports, "hasAnnotationMark", {
|
|
17
17
|
enumerable: true,
|
|
@@ -23,7 +23,7 @@ exports.hasInvalidNodes = void 0;
|
|
|
23
23
|
exports.hasInvalidWhitespaceNode = hasInvalidWhitespaceNode;
|
|
24
24
|
exports.inlineCommentPluginKey = void 0;
|
|
25
25
|
exports.isSelectedAnnotationsChanged = isSelectedAnnotationsChanged;
|
|
26
|
-
exports.isSupportedBlockNode = exports.isSelectionValid = void 0;
|
|
26
|
+
exports.resolveDraftBookmark = exports.isSupportedBlockNode = exports.isSelectionValid = void 0;
|
|
27
27
|
exports.stripNonExistingAnnotations = stripNonExistingAnnotations;
|
|
28
28
|
exports.surroundingMarks = void 0;
|
|
29
29
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
@@ -125,7 +125,10 @@ var validateAnnotationMark = function validateAnnotationMark(annotationMark) {
|
|
|
125
125
|
return allowedTypes.includes(type);
|
|
126
126
|
}
|
|
127
127
|
};
|
|
128
|
-
|
|
128
|
+
var decorationKey = exports.decorationKey = {
|
|
129
|
+
block: 'blockCommentDecoration',
|
|
130
|
+
inline: 'inlineCommentDecoration'
|
|
131
|
+
};
|
|
129
132
|
/*
|
|
130
133
|
* add decoration for the comment selection in draft state
|
|
131
134
|
* (when creating new comment)
|
|
@@ -134,11 +137,15 @@ var addDraftDecoration = exports.addDraftDecoration = function addDraftDecoratio
|
|
|
134
137
|
var targetType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'inline';
|
|
135
138
|
if (targetType === 'block') {
|
|
136
139
|
return _view.Decoration.node(start, end, {
|
|
137
|
-
class: "".concat(_styles.
|
|
140
|
+
class: "".concat(_styles.BlockAnnotationSharedClassNames.draft)
|
|
141
|
+
}, {
|
|
142
|
+
key: decorationKey.block
|
|
138
143
|
});
|
|
139
144
|
}
|
|
140
145
|
return _view.Decoration.inline(start, end, {
|
|
141
146
|
class: "".concat(_styles.AnnotationSharedClassNames.draft)
|
|
147
|
+
}, {
|
|
148
|
+
key: decorationKey.inline
|
|
142
149
|
});
|
|
143
150
|
};
|
|
144
151
|
var getAnnotationViewKey = exports.getAnnotationViewKey = function getAnnotationViewKey(annotations) {
|
|
@@ -179,7 +186,41 @@ var findAnnotationsInSelection = exports.findAnnotationsInSelection = function f
|
|
|
179
186
|
reorderAnnotations(annotations, $anchor);
|
|
180
187
|
return annotations;
|
|
181
188
|
};
|
|
182
|
-
|
|
189
|
+
var resolveDraftBookmark = exports.resolveDraftBookmark = function resolveDraftBookmark(editorState, bookmark) {
|
|
190
|
+
var supportedBlockNodes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
191
|
+
var doc = editorState.doc;
|
|
192
|
+
var resolvedBookmark = bookmark.resolve(doc);
|
|
193
|
+
var from = resolvedBookmark.from,
|
|
194
|
+
to = resolvedBookmark.to,
|
|
195
|
+
head = resolvedBookmark.head;
|
|
196
|
+
var draftBookmark = {
|
|
197
|
+
from: from,
|
|
198
|
+
to: to,
|
|
199
|
+
head: head
|
|
200
|
+
};
|
|
201
|
+
if (resolvedBookmark instanceof _state.NodeSelection) {
|
|
202
|
+
// It's possible that annotation is only allowed in child node instead parent (e.g. mediaSingle vs media),
|
|
203
|
+
// thus, we traverse the node to find the first node that supports annotation and return its position
|
|
204
|
+
var nodeFound = false;
|
|
205
|
+
doc.nodesBetween(from, to, function (node, pos) {
|
|
206
|
+
// if we find the node, breakout the traversal to make sure we always record the first supported node
|
|
207
|
+
if (nodeFound) {
|
|
208
|
+
return false;
|
|
209
|
+
}
|
|
210
|
+
var nodeEndsAt = pos + node.nodeSize;
|
|
211
|
+
if (supportedBlockNodes.includes(node.type.name)) {
|
|
212
|
+
draftBookmark = {
|
|
213
|
+
from: pos,
|
|
214
|
+
to: nodeEndsAt,
|
|
215
|
+
head: nodeEndsAt
|
|
216
|
+
};
|
|
217
|
+
nodeFound = true;
|
|
218
|
+
return false;
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
return draftBookmark;
|
|
223
|
+
};
|
|
183
224
|
/**
|
|
184
225
|
* get selection from position to apply new comment for
|
|
185
226
|
* @return bookmarked positions if they exists, otherwise current selection positions
|
|
@@ -86,7 +86,7 @@ export const removeInlineCommentNearSelection = (id, supportedNodes = []) => (st
|
|
|
86
86
|
}
|
|
87
87
|
return true;
|
|
88
88
|
};
|
|
89
|
-
const getDraftCommandAction = (drafting, targetType, isCommentOnMediaOn) => {
|
|
89
|
+
const getDraftCommandAction = (drafting, targetType, isCommentOnMediaOn, supportedBlockNodes) => {
|
|
90
90
|
return editorState => {
|
|
91
91
|
// validate selection only when entering draft mode
|
|
92
92
|
if (drafting && isSelectionValid(editorState, isCommentOnMediaOn) !== AnnotationSelectionType.VALID) {
|
|
@@ -97,13 +97,15 @@ const getDraftCommandAction = (drafting, targetType, isCommentOnMediaOn) => {
|
|
|
97
97
|
data: {
|
|
98
98
|
drafting,
|
|
99
99
|
editorState,
|
|
100
|
-
targetType
|
|
100
|
+
targetType,
|
|
101
|
+
isCommentOnMediaOn,
|
|
102
|
+
supportedBlockNodes
|
|
101
103
|
}
|
|
102
104
|
};
|
|
103
105
|
};
|
|
104
106
|
};
|
|
105
|
-
export const setInlineCommentDraftState = editorAnalyticsAPI => (drafting, inputMethod = INPUT_METHOD.TOOLBAR, targetType = 'inline', isCommentOnMediaOn = false) => {
|
|
106
|
-
const commandAction = getDraftCommandAction(drafting, targetType, isCommentOnMediaOn);
|
|
107
|
+
export const setInlineCommentDraftState = (editorAnalyticsAPI, supportedBlockNodes = []) => (drafting, inputMethod = INPUT_METHOD.TOOLBAR, targetType = 'inline', isCommentOnMediaOn = false) => {
|
|
108
|
+
const commandAction = getDraftCommandAction(drafting, targetType, isCommentOnMediaOn, supportedBlockNodes);
|
|
107
109
|
return createCommand(commandAction, transform.addOpenCloseAnalytics(editorAnalyticsAPI)(drafting, inputMethod));
|
|
108
110
|
};
|
|
109
111
|
export const addInlineComment = (editorAnalyticsAPI, editorAPI) => id => {
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -25,13 +25,16 @@ export const annotationPlugin = ({
|
|
|
25
25
|
},
|
|
26
26
|
actions: {
|
|
27
27
|
stripNonExistingAnnotations,
|
|
28
|
-
setInlineCommentDraftState: setInlineCommentDraftState(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)
|
|
28
|
+
setInlineCommentDraftState: setInlineCommentDraftState(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.supportedBlockNodes)
|
|
29
29
|
},
|
|
30
30
|
getSharedState(editorState) {
|
|
31
31
|
if (!editorState) {
|
|
32
32
|
return undefined;
|
|
33
33
|
}
|
|
34
|
-
|
|
34
|
+
const pluginState = getPluginState(editorState) || undefined;
|
|
35
|
+
const clonedPluginState = Object.assign({}, pluginState);
|
|
36
|
+
clonedPluginState === null || clonedPluginState === void 0 ? true : delete clonedPluginState.featureFlagsPluginState;
|
|
37
|
+
return clonedPluginState;
|
|
35
38
|
},
|
|
36
39
|
pmPlugins: () => [{
|
|
37
40
|
name: 'annotation',
|
|
@@ -47,7 +50,8 @@ export const annotationPlugin = ({
|
|
|
47
50
|
portalProviderAPI,
|
|
48
51
|
eventDispatcher,
|
|
49
52
|
provider: annotationProviders.inlineComment,
|
|
50
|
-
editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions
|
|
53
|
+
editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions,
|
|
54
|
+
featureFlagsPluginState: featureFlags
|
|
51
55
|
});
|
|
52
56
|
}
|
|
53
57
|
return;
|
|
@@ -28,7 +28,7 @@ const fetchState = async (provider, annotationIds, editorView, editorAnalyticsAP
|
|
|
28
28
|
updateInlineCommentResolvedState(editorAnalyticsAPI)(inlineCommentStates)(editorView.state, editorView.dispatch);
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
|
-
const initialState = (disallowOnWhitespace = false) => {
|
|
31
|
+
const initialState = (disallowOnWhitespace = false, featureFlagsPluginState) => {
|
|
32
32
|
return {
|
|
33
33
|
annotations: {},
|
|
34
34
|
selectedAnnotations: [],
|
|
@@ -38,7 +38,8 @@ const initialState = (disallowOnWhitespace = false) => {
|
|
|
38
38
|
disallowOnWhitespace,
|
|
39
39
|
isInlineCommentViewClosed: false,
|
|
40
40
|
isVisible: true,
|
|
41
|
-
skipSelectionHandling: false
|
|
41
|
+
skipSelectionHandling: false,
|
|
42
|
+
featureFlagsPluginState
|
|
42
43
|
};
|
|
43
44
|
};
|
|
44
45
|
const hideToolbar = (state, dispatch) => () => {
|
|
@@ -86,11 +87,12 @@ export const inlineCommentPlugin = options => {
|
|
|
86
87
|
const {
|
|
87
88
|
provider,
|
|
88
89
|
portalProviderAPI,
|
|
89
|
-
eventDispatcher
|
|
90
|
+
eventDispatcher,
|
|
91
|
+
featureFlagsPluginState
|
|
90
92
|
} = options;
|
|
91
93
|
return new SafePlugin({
|
|
92
94
|
key: inlineCommentPluginKey,
|
|
93
|
-
state: createPluginState(options.dispatch, initialState(provider.disallowOnWhitespace)),
|
|
95
|
+
state: createPluginState(options.dispatch, initialState(provider.disallowOnWhitespace, featureFlagsPluginState)),
|
|
94
96
|
view(editorView) {
|
|
95
97
|
// Get initial state
|
|
96
98
|
// Need to pass `editorView` to mitigate editor state going stale
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { pluginFactory } from '@atlaskit/editor-common/utils';
|
|
2
|
-
import {
|
|
2
|
+
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
+
import { decorationKey, findAnnotationsInSelection, inlineCommentPluginKey, isSelectedAnnotationsChanged } from '../utils';
|
|
3
4
|
import reducer from './reducer';
|
|
4
5
|
const handleDocChanged = (tr, prevPluginState) => {
|
|
5
6
|
if (!tr.getMeta('replaceDocument')) {
|
|
@@ -50,15 +51,31 @@ export const {
|
|
|
50
51
|
} = pluginFactory(inlineCommentPluginKey, reducer, {
|
|
51
52
|
onSelectionChanged: getSelectionChangedHandler(true),
|
|
52
53
|
onDocChanged: handleDocChanged,
|
|
53
|
-
mapping: (tr, pluginState) => {
|
|
54
|
+
mapping: (tr, pluginState, editorState) => {
|
|
54
55
|
let {
|
|
55
56
|
draftDecorationSet,
|
|
56
|
-
bookmark
|
|
57
|
+
bookmark,
|
|
58
|
+
featureFlagsPluginState
|
|
57
59
|
} = pluginState;
|
|
58
|
-
let mappedDecorationSet,
|
|
60
|
+
let mappedDecorationSet = DecorationSet.empty,
|
|
61
|
+
mappedBookmark;
|
|
62
|
+
let hasMappedDecorations = false;
|
|
59
63
|
if (draftDecorationSet) {
|
|
60
64
|
mappedDecorationSet = draftDecorationSet.map(tr.mapping, tr.doc);
|
|
61
65
|
}
|
|
66
|
+
if (featureFlagsPluginState !== null && featureFlagsPluginState !== void 0 && featureFlagsPluginState.commentsOnMedia) {
|
|
67
|
+
hasMappedDecorations = mappedDecorationSet.find(undefined, undefined, spec => Object.values(decorationKey).includes(spec.key)).length > 0;
|
|
68
|
+
|
|
69
|
+
// When changes to decoration target make decoration invalid (e.g. delete text, add mark to node),
|
|
70
|
+
// we need to reset bookmark to hide create component and to avoid invalid draft being published
|
|
71
|
+
if (!hasMappedDecorations) {
|
|
72
|
+
return {
|
|
73
|
+
...pluginState,
|
|
74
|
+
draftDecorationSet: mappedDecorationSet,
|
|
75
|
+
bookmark: undefined
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
}
|
|
62
79
|
if (bookmark) {
|
|
63
80
|
mappedBookmark = bookmark.map(tr.mapping);
|
|
64
81
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
2
|
-
import { addDraftDecoration } from '../utils';
|
|
2
|
+
import { addDraftDecoration, resolveDraftBookmark } from '../utils';
|
|
3
3
|
import { ACTIONS } from './types';
|
|
4
4
|
export default ((pluginState, action) => {
|
|
5
5
|
switch (action.type) {
|
|
@@ -18,7 +18,7 @@ export default ((pluginState, action) => {
|
|
|
18
18
|
mouseData
|
|
19
19
|
};
|
|
20
20
|
case ACTIONS.SET_INLINE_COMMENT_DRAFT_STATE:
|
|
21
|
-
return getNewDraftState(pluginState, action.data.drafting, action.data.editorState, action.data.targetType);
|
|
21
|
+
return getNewDraftState(pluginState, action.data.drafting, action.data.editorState, action.data.targetType, action.data.isCommentOnMediaOn, action.data.supportedBlockNodes);
|
|
22
22
|
case ACTIONS.INLINE_COMMENT_CLEAR_DIRTY_MARK:
|
|
23
23
|
return {
|
|
24
24
|
...pluginState,
|
|
@@ -63,7 +63,7 @@ export default ((pluginState, action) => {
|
|
|
63
63
|
return pluginState;
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
|
-
function getNewDraftState(pluginState, drafting, editorState, targetType) {
|
|
66
|
+
function getNewDraftState(pluginState, drafting, editorState, targetType, isCommentOnMediaOn, supportedBlockNodes) {
|
|
67
67
|
let {
|
|
68
68
|
draftDecorationSet
|
|
69
69
|
} = pluginState;
|
|
@@ -77,8 +77,11 @@ function getNewDraftState(pluginState, drafting, editorState, targetType) {
|
|
|
77
77
|
newState.bookmark = undefined;
|
|
78
78
|
if (drafting && editorState) {
|
|
79
79
|
newState.bookmark = editorState.selection.getBookmark();
|
|
80
|
-
const
|
|
81
|
-
|
|
80
|
+
const {
|
|
81
|
+
from,
|
|
82
|
+
to
|
|
83
|
+
} = isCommentOnMediaOn ? resolveDraftBookmark(editorState, newState.bookmark, supportedBlockNodes) : newState.bookmark.resolve(editorState.doc);
|
|
84
|
+
const draftDecoration = addDraftDecoration(from, to, targetType);
|
|
82
85
|
newState.draftDecorationSet = draftDecorationSet.add(editorState.doc, [draftDecoration]);
|
|
83
86
|
}
|
|
84
87
|
return newState;
|
package/dist/es2019/utils.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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
3
|
import { currentMediaNodeWithPos } from '@atlaskit/editor-common/media-single';
|
|
4
|
-
import { AnnotationSharedClassNames } from '@atlaskit/editor-common/styles';
|
|
4
|
+
import { AnnotationSharedClassNames, BlockAnnotationSharedClassNames } from '@atlaskit/editor-common/styles';
|
|
5
5
|
import { canApplyAnnotationOnRange, containsAnyAnnotations, getAnnotationIdsFromRange, hasAnnotationMark, isParagraph, isText } from '@atlaskit/editor-common/utils';
|
|
6
|
-
import { AllSelection, PluginKey, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
6
|
+
import { AllSelection, NodeSelection, PluginKey, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
7
7
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
8
8
|
import { AnnotationSelectionType } from './types';
|
|
9
9
|
export { hasAnnotationMark, containsAnyAnnotations };
|
|
@@ -87,7 +87,10 @@ const validateAnnotationMark = annotationMark => {
|
|
|
87
87
|
return allowedTypes.includes(type);
|
|
88
88
|
}
|
|
89
89
|
};
|
|
90
|
-
|
|
90
|
+
export const decorationKey = {
|
|
91
|
+
block: 'blockCommentDecoration',
|
|
92
|
+
inline: 'inlineCommentDecoration'
|
|
93
|
+
};
|
|
91
94
|
/*
|
|
92
95
|
* add decoration for the comment selection in draft state
|
|
93
96
|
* (when creating new comment)
|
|
@@ -95,11 +98,15 @@ const validateAnnotationMark = annotationMark => {
|
|
|
95
98
|
export const addDraftDecoration = (start, end, targetType = 'inline') => {
|
|
96
99
|
if (targetType === 'block') {
|
|
97
100
|
return Decoration.node(start, end, {
|
|
98
|
-
class: `${
|
|
101
|
+
class: `${BlockAnnotationSharedClassNames.draft}`
|
|
102
|
+
}, {
|
|
103
|
+
key: decorationKey.block
|
|
99
104
|
});
|
|
100
105
|
}
|
|
101
106
|
return Decoration.inline(start, end, {
|
|
102
107
|
class: `${AnnotationSharedClassNames.draft}`
|
|
108
|
+
}, {
|
|
109
|
+
key: decorationKey.inline
|
|
103
110
|
});
|
|
104
111
|
};
|
|
105
112
|
export const getAnnotationViewKey = annotations => {
|
|
@@ -136,7 +143,44 @@ export const findAnnotationsInSelection = (selection, doc) => {
|
|
|
136
143
|
reorderAnnotations(annotations, $anchor);
|
|
137
144
|
return annotations;
|
|
138
145
|
};
|
|
139
|
-
|
|
146
|
+
export const resolveDraftBookmark = (editorState, bookmark, supportedBlockNodes = []) => {
|
|
147
|
+
const {
|
|
148
|
+
doc
|
|
149
|
+
} = editorState;
|
|
150
|
+
const resolvedBookmark = bookmark.resolve(doc);
|
|
151
|
+
const {
|
|
152
|
+
from,
|
|
153
|
+
to,
|
|
154
|
+
head
|
|
155
|
+
} = resolvedBookmark;
|
|
156
|
+
let draftBookmark = {
|
|
157
|
+
from,
|
|
158
|
+
to,
|
|
159
|
+
head
|
|
160
|
+
};
|
|
161
|
+
if (resolvedBookmark instanceof NodeSelection) {
|
|
162
|
+
// It's possible that annotation is only allowed in child node instead parent (e.g. mediaSingle vs media),
|
|
163
|
+
// thus, we traverse the node to find the first node that supports annotation and return its position
|
|
164
|
+
let nodeFound = false;
|
|
165
|
+
doc.nodesBetween(from, to, (node, pos) => {
|
|
166
|
+
// if we find the node, breakout the traversal to make sure we always record the first supported node
|
|
167
|
+
if (nodeFound) {
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
const nodeEndsAt = pos + node.nodeSize;
|
|
171
|
+
if (supportedBlockNodes.includes(node.type.name)) {
|
|
172
|
+
draftBookmark = {
|
|
173
|
+
from: pos,
|
|
174
|
+
to: nodeEndsAt,
|
|
175
|
+
head: nodeEndsAt
|
|
176
|
+
};
|
|
177
|
+
nodeFound = true;
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
return draftBookmark;
|
|
183
|
+
};
|
|
140
184
|
/**
|
|
141
185
|
* get selection from position to apply new comment for
|
|
142
186
|
* @return bookmarked positions if they exists, otherwise current selection positions
|
|
@@ -93,7 +93,7 @@ export var removeInlineCommentNearSelection = function removeInlineCommentNearSe
|
|
|
93
93
|
return true;
|
|
94
94
|
};
|
|
95
95
|
};
|
|
96
|
-
var getDraftCommandAction = function getDraftCommandAction(drafting, targetType, isCommentOnMediaOn) {
|
|
96
|
+
var getDraftCommandAction = function getDraftCommandAction(drafting, targetType, isCommentOnMediaOn, supportedBlockNodes) {
|
|
97
97
|
return function (editorState) {
|
|
98
98
|
// validate selection only when entering draft mode
|
|
99
99
|
if (drafting && isSelectionValid(editorState, isCommentOnMediaOn) !== AnnotationSelectionType.VALID) {
|
|
@@ -104,17 +104,20 @@ var getDraftCommandAction = function getDraftCommandAction(drafting, targetType,
|
|
|
104
104
|
data: {
|
|
105
105
|
drafting: drafting,
|
|
106
106
|
editorState: editorState,
|
|
107
|
-
targetType: targetType
|
|
107
|
+
targetType: targetType,
|
|
108
|
+
isCommentOnMediaOn: isCommentOnMediaOn,
|
|
109
|
+
supportedBlockNodes: supportedBlockNodes
|
|
108
110
|
}
|
|
109
111
|
};
|
|
110
112
|
};
|
|
111
113
|
};
|
|
112
114
|
export var setInlineCommentDraftState = function setInlineCommentDraftState(editorAnalyticsAPI) {
|
|
115
|
+
var supportedBlockNodes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
113
116
|
return function (drafting) {
|
|
114
117
|
var inputMethod = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : INPUT_METHOD.TOOLBAR;
|
|
115
118
|
var targetType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'inline';
|
|
116
119
|
var isCommentOnMediaOn = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
117
|
-
var commandAction = getDraftCommandAction(drafting, targetType, isCommentOnMediaOn);
|
|
120
|
+
var commandAction = getDraftCommandAction(drafting, targetType, isCommentOnMediaOn, supportedBlockNodes);
|
|
118
121
|
return createCommand(commandAction, transform.addOpenCloseAnalytics(editorAnalyticsAPI)(drafting, inputMethod));
|
|
119
122
|
};
|
|
120
123
|
};
|
package/dist/esm/plugin.js
CHANGED
|
@@ -24,13 +24,16 @@ export var annotationPlugin = function annotationPlugin(_ref) {
|
|
|
24
24
|
},
|
|
25
25
|
actions: {
|
|
26
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)
|
|
27
|
+
setInlineCommentDraftState: setInlineCommentDraftState(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.supportedBlockNodes)
|
|
28
28
|
},
|
|
29
29
|
getSharedState: function getSharedState(editorState) {
|
|
30
30
|
if (!editorState) {
|
|
31
31
|
return undefined;
|
|
32
32
|
}
|
|
33
|
-
|
|
33
|
+
var pluginState = getPluginState(editorState) || undefined;
|
|
34
|
+
var clonedPluginState = Object.assign({}, pluginState);
|
|
35
|
+
clonedPluginState === null || clonedPluginState === void 0 || delete clonedPluginState.featureFlagsPluginState;
|
|
36
|
+
return clonedPluginState;
|
|
34
37
|
},
|
|
35
38
|
pmPlugins: function pmPlugins() {
|
|
36
39
|
return [{
|
|
@@ -46,7 +49,8 @@ export var annotationPlugin = function annotationPlugin(_ref) {
|
|
|
46
49
|
portalProviderAPI: portalProviderAPI,
|
|
47
50
|
eventDispatcher: eventDispatcher,
|
|
48
51
|
provider: annotationProviders.inlineComment,
|
|
49
|
-
editorAnalyticsAPI: api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions
|
|
52
|
+
editorAnalyticsAPI: api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions,
|
|
53
|
+
featureFlagsPluginState: featureFlags
|
|
50
54
|
});
|
|
51
55
|
}
|
|
52
56
|
return;
|
|
@@ -70,6 +70,7 @@ var fetchState = /*#__PURE__*/function () {
|
|
|
70
70
|
}();
|
|
71
71
|
var initialState = function initialState() {
|
|
72
72
|
var disallowOnWhitespace = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
73
|
+
var featureFlagsPluginState = arguments.length > 1 ? arguments[1] : undefined;
|
|
73
74
|
return {
|
|
74
75
|
annotations: {},
|
|
75
76
|
selectedAnnotations: [],
|
|
@@ -79,7 +80,8 @@ var initialState = function initialState() {
|
|
|
79
80
|
disallowOnWhitespace: disallowOnWhitespace,
|
|
80
81
|
isInlineCommentViewClosed: false,
|
|
81
82
|
isVisible: true,
|
|
82
|
-
skipSelectionHandling: false
|
|
83
|
+
skipSelectionHandling: false,
|
|
84
|
+
featureFlagsPluginState: featureFlagsPluginState
|
|
83
85
|
};
|
|
84
86
|
};
|
|
85
87
|
var hideToolbar = function hideToolbar(state, dispatch) {
|
|
@@ -133,10 +135,11 @@ var onSetVisibility = function onSetVisibility(view) {
|
|
|
133
135
|
export var inlineCommentPlugin = function inlineCommentPlugin(options) {
|
|
134
136
|
var provider = options.provider,
|
|
135
137
|
portalProviderAPI = options.portalProviderAPI,
|
|
136
|
-
eventDispatcher = options.eventDispatcher
|
|
138
|
+
eventDispatcher = options.eventDispatcher,
|
|
139
|
+
featureFlagsPluginState = options.featureFlagsPluginState;
|
|
137
140
|
return new SafePlugin({
|
|
138
141
|
key: inlineCommentPluginKey,
|
|
139
|
-
state: createPluginState(options.dispatch, initialState(provider.disallowOnWhitespace)),
|
|
142
|
+
state: createPluginState(options.dispatch, initialState(provider.disallowOnWhitespace, featureFlagsPluginState)),
|
|
140
143
|
view: function view(editorView) {
|
|
141
144
|
// Get initial state
|
|
142
145
|
// Need to pass `editorView` to mitigate editor state going stale
|
|
@@ -2,7 +2,8 @@ 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 {
|
|
5
|
+
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
6
|
+
import { decorationKey, findAnnotationsInSelection, inlineCommentPluginKey, isSelectedAnnotationsChanged } from '../utils';
|
|
6
7
|
import reducer from './reducer';
|
|
7
8
|
var handleDocChanged = function handleDocChanged(tr, prevPluginState) {
|
|
8
9
|
if (!tr.getMeta('replaceDocument')) {
|
|
@@ -43,13 +44,30 @@ var getSelectionChangedHandler = function getSelectionChangedHandler(reopenComme
|
|
|
43
44
|
var _pluginFactory = pluginFactory(inlineCommentPluginKey, reducer, {
|
|
44
45
|
onSelectionChanged: getSelectionChangedHandler(true),
|
|
45
46
|
onDocChanged: handleDocChanged,
|
|
46
|
-
mapping: function mapping(tr, pluginState) {
|
|
47
|
+
mapping: function mapping(tr, pluginState, editorState) {
|
|
47
48
|
var draftDecorationSet = pluginState.draftDecorationSet,
|
|
48
|
-
bookmark = pluginState.bookmark
|
|
49
|
-
|
|
49
|
+
bookmark = pluginState.bookmark,
|
|
50
|
+
featureFlagsPluginState = pluginState.featureFlagsPluginState;
|
|
51
|
+
var mappedDecorationSet = DecorationSet.empty,
|
|
52
|
+
mappedBookmark;
|
|
53
|
+
var hasMappedDecorations = false;
|
|
50
54
|
if (draftDecorationSet) {
|
|
51
55
|
mappedDecorationSet = draftDecorationSet.map(tr.mapping, tr.doc);
|
|
52
56
|
}
|
|
57
|
+
if (featureFlagsPluginState !== null && featureFlagsPluginState !== void 0 && featureFlagsPluginState.commentsOnMedia) {
|
|
58
|
+
hasMappedDecorations = mappedDecorationSet.find(undefined, undefined, function (spec) {
|
|
59
|
+
return Object.values(decorationKey).includes(spec.key);
|
|
60
|
+
}).length > 0;
|
|
61
|
+
|
|
62
|
+
// When changes to decoration target make decoration invalid (e.g. delete text, add mark to node),
|
|
63
|
+
// we need to reset bookmark to hide create component and to avoid invalid draft being published
|
|
64
|
+
if (!hasMappedDecorations) {
|
|
65
|
+
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
66
|
+
draftDecorationSet: mappedDecorationSet,
|
|
67
|
+
bookmark: undefined
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
53
71
|
if (bookmark) {
|
|
54
72
|
mappedBookmark = bookmark.map(tr.mapping);
|
|
55
73
|
}
|
|
@@ -3,7 +3,7 @@ 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 { addDraftDecoration } from '../utils';
|
|
6
|
+
import { addDraftDecoration, resolveDraftBookmark } from '../utils';
|
|
7
7
|
import { ACTIONS } from './types';
|
|
8
8
|
export default (function (pluginState, action) {
|
|
9
9
|
switch (action.type) {
|
|
@@ -17,7 +17,7 @@ export default (function (pluginState, action) {
|
|
|
17
17
|
mouseData: mouseData
|
|
18
18
|
});
|
|
19
19
|
case ACTIONS.SET_INLINE_COMMENT_DRAFT_STATE:
|
|
20
|
-
return getNewDraftState(pluginState, action.data.drafting, action.data.editorState, action.data.targetType);
|
|
20
|
+
return getNewDraftState(pluginState, action.data.drafting, action.data.editorState, action.data.targetType, action.data.isCommentOnMediaOn, action.data.supportedBlockNodes);
|
|
21
21
|
case ACTIONS.INLINE_COMMENT_CLEAR_DIRTY_MARK:
|
|
22
22
|
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
23
23
|
dirtyAnnotations: false,
|
|
@@ -52,7 +52,7 @@ export default (function (pluginState, action) {
|
|
|
52
52
|
return pluginState;
|
|
53
53
|
}
|
|
54
54
|
});
|
|
55
|
-
function getNewDraftState(pluginState, drafting, editorState, targetType) {
|
|
55
|
+
function getNewDraftState(pluginState, drafting, editorState, targetType, isCommentOnMediaOn, supportedBlockNodes) {
|
|
56
56
|
var draftDecorationSet = pluginState.draftDecorationSet;
|
|
57
57
|
if (!draftDecorationSet || !drafting) {
|
|
58
58
|
draftDecorationSet = DecorationSet.empty;
|
|
@@ -63,8 +63,10 @@ function getNewDraftState(pluginState, drafting, editorState, targetType) {
|
|
|
63
63
|
newState.bookmark = undefined;
|
|
64
64
|
if (drafting && editorState) {
|
|
65
65
|
newState.bookmark = editorState.selection.getBookmark();
|
|
66
|
-
var
|
|
67
|
-
|
|
66
|
+
var _ref = isCommentOnMediaOn ? resolveDraftBookmark(editorState, newState.bookmark, supportedBlockNodes) : newState.bookmark.resolve(editorState.doc),
|
|
67
|
+
from = _ref.from,
|
|
68
|
+
to = _ref.to;
|
|
69
|
+
var draftDecoration = addDraftDecoration(from, to, targetType);
|
|
68
70
|
newState.draftDecorationSet = draftDecorationSet.add(editorState.doc, [draftDecoration]);
|
|
69
71
|
}
|
|
70
72
|
return newState;
|
package/dist/esm/utils.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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
3
|
import { currentMediaNodeWithPos } from '@atlaskit/editor-common/media-single';
|
|
4
|
-
import { AnnotationSharedClassNames } from '@atlaskit/editor-common/styles';
|
|
4
|
+
import { AnnotationSharedClassNames, BlockAnnotationSharedClassNames } from '@atlaskit/editor-common/styles';
|
|
5
5
|
import { canApplyAnnotationOnRange, containsAnyAnnotations, getAnnotationIdsFromRange, hasAnnotationMark, isParagraph, isText } from '@atlaskit/editor-common/utils';
|
|
6
|
-
import { AllSelection, PluginKey, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
6
|
+
import { AllSelection, NodeSelection, PluginKey, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
7
7
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
8
8
|
import { AnnotationSelectionType } from './types';
|
|
9
9
|
export { hasAnnotationMark, containsAnyAnnotations };
|
|
@@ -98,7 +98,10 @@ var validateAnnotationMark = function validateAnnotationMark(annotationMark) {
|
|
|
98
98
|
return allowedTypes.includes(type);
|
|
99
99
|
}
|
|
100
100
|
};
|
|
101
|
-
|
|
101
|
+
export var decorationKey = {
|
|
102
|
+
block: 'blockCommentDecoration',
|
|
103
|
+
inline: 'inlineCommentDecoration'
|
|
104
|
+
};
|
|
102
105
|
/*
|
|
103
106
|
* add decoration for the comment selection in draft state
|
|
104
107
|
* (when creating new comment)
|
|
@@ -107,11 +110,15 @@ export var addDraftDecoration = function addDraftDecoration(start, end) {
|
|
|
107
110
|
var targetType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'inline';
|
|
108
111
|
if (targetType === 'block') {
|
|
109
112
|
return Decoration.node(start, end, {
|
|
110
|
-
class: "".concat(
|
|
113
|
+
class: "".concat(BlockAnnotationSharedClassNames.draft)
|
|
114
|
+
}, {
|
|
115
|
+
key: decorationKey.block
|
|
111
116
|
});
|
|
112
117
|
}
|
|
113
118
|
return Decoration.inline(start, end, {
|
|
114
119
|
class: "".concat(AnnotationSharedClassNames.draft)
|
|
120
|
+
}, {
|
|
121
|
+
key: decorationKey.inline
|
|
115
122
|
});
|
|
116
123
|
};
|
|
117
124
|
export var getAnnotationViewKey = function getAnnotationViewKey(annotations) {
|
|
@@ -152,7 +159,41 @@ export var findAnnotationsInSelection = function findAnnotationsInSelection(sele
|
|
|
152
159
|
reorderAnnotations(annotations, $anchor);
|
|
153
160
|
return annotations;
|
|
154
161
|
};
|
|
155
|
-
|
|
162
|
+
export var resolveDraftBookmark = function resolveDraftBookmark(editorState, bookmark) {
|
|
163
|
+
var supportedBlockNodes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
164
|
+
var doc = editorState.doc;
|
|
165
|
+
var resolvedBookmark = bookmark.resolve(doc);
|
|
166
|
+
var from = resolvedBookmark.from,
|
|
167
|
+
to = resolvedBookmark.to,
|
|
168
|
+
head = resolvedBookmark.head;
|
|
169
|
+
var draftBookmark = {
|
|
170
|
+
from: from,
|
|
171
|
+
to: to,
|
|
172
|
+
head: head
|
|
173
|
+
};
|
|
174
|
+
if (resolvedBookmark instanceof NodeSelection) {
|
|
175
|
+
// It's possible that annotation is only allowed in child node instead parent (e.g. mediaSingle vs media),
|
|
176
|
+
// thus, we traverse the node to find the first node that supports annotation and return its position
|
|
177
|
+
var nodeFound = false;
|
|
178
|
+
doc.nodesBetween(from, to, function (node, pos) {
|
|
179
|
+
// if we find the node, breakout the traversal to make sure we always record the first supported node
|
|
180
|
+
if (nodeFound) {
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
var nodeEndsAt = pos + node.nodeSize;
|
|
184
|
+
if (supportedBlockNodes.includes(node.type.name)) {
|
|
185
|
+
draftBookmark = {
|
|
186
|
+
from: pos,
|
|
187
|
+
to: nodeEndsAt,
|
|
188
|
+
head: nodeEndsAt
|
|
189
|
+
};
|
|
190
|
+
nodeFound = true;
|
|
191
|
+
return false;
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
return draftBookmark;
|
|
196
|
+
};
|
|
156
197
|
/**
|
|
157
198
|
* get selection from position to apply new comment for
|
|
158
199
|
* @return bookmarked positions if they exists, otherwise current selection positions
|
|
@@ -7,7 +7,7 @@ export declare const updateInlineCommentResolvedState: (editorAnalyticsAPI: Edit
|
|
|
7
7
|
export declare const closeComponent: () => Command;
|
|
8
8
|
export declare const clearDirtyMark: () => Command;
|
|
9
9
|
export declare const removeInlineCommentNearSelection: (id: string, supportedNodes?: string[]) => Command;
|
|
10
|
-
export declare const setInlineCommentDraftState: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (drafting: boolean, inputMethod?: InlineCommentInputMethod, targetType?: TargetType, isCommentOnMediaOn?: boolean) => Command;
|
|
10
|
+
export declare const setInlineCommentDraftState: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, supportedBlockNodes?: string[]) => (drafting: boolean, inputMethod?: InlineCommentInputMethod, targetType?: TargetType, isCommentOnMediaOn?: boolean) => Command;
|
|
11
11
|
export declare const addInlineComment: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, editorAPI?: ExtractInjectionAPI<AnnotationPlugin> | undefined) => (id: string) => Command;
|
|
12
12
|
export declare const updateMouseState: (mouseData: InlineCommentMouseData) => Command;
|
|
13
13
|
export declare const setSelectedAnnotation: (id: string) => Command;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import type { Dispatch, EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
3
3
|
import type { PortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
|
|
4
|
+
import type { FeatureFlags } from '@atlaskit/editor-common/types';
|
|
4
5
|
import type { EditorState, SelectionBookmark } from '@atlaskit/editor-prosemirror/state';
|
|
5
6
|
import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
6
7
|
import type { AnnotationInfo, InlineCommentAnnotationProvider, TargetType } from '../types';
|
|
@@ -20,6 +21,7 @@ export interface InlineCommentPluginOptions {
|
|
|
20
21
|
portalProviderAPI: PortalProviderAPI;
|
|
21
22
|
provider: InlineCommentAnnotationProvider;
|
|
22
23
|
editorAnalyticsAPI: EditorAnalyticsAPI | undefined;
|
|
24
|
+
featureFlagsPluginState?: FeatureFlags;
|
|
23
25
|
}
|
|
24
26
|
export interface InlineCommentMouseData {
|
|
25
27
|
isSelecting: boolean;
|
|
@@ -36,6 +38,8 @@ export type InlineCommentAction = {
|
|
|
36
38
|
drafting: boolean;
|
|
37
39
|
editorState: EditorState;
|
|
38
40
|
targetType?: TargetType;
|
|
41
|
+
isCommentOnMediaOn?: boolean;
|
|
42
|
+
supportedBlockNodes?: string[];
|
|
39
43
|
};
|
|
40
44
|
} | {
|
|
41
45
|
type: ACTIONS.INLINE_COMMENT_UPDATE_MOUSE_STATE;
|
|
@@ -76,4 +80,5 @@ export type InlineCommentPluginState = {
|
|
|
76
80
|
isInlineCommentViewClosed: boolean;
|
|
77
81
|
isVisible: boolean;
|
|
78
82
|
skipSelectionHandling: boolean;
|
|
83
|
+
featureFlagsPluginState?: FeatureFlags;
|
|
79
84
|
};
|
package/dist/types/types.d.ts
CHANGED
package/dist/types/utils.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { AnalyticsEventPayloadCallback } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { containsAnyAnnotations, hasAnnotationMark } from '@atlaskit/editor-common/utils';
|
|
3
3
|
import type { Mark, Node, ResolvedPos, Schema, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
4
|
-
import type { EditorState, Selection } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
+
import type { EditorState, Selection, SelectionBookmark } from '@atlaskit/editor-prosemirror/state';
|
|
5
5
|
import { AllSelection, PluginKey, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
6
6
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
7
7
|
import type { InlineCommentPluginState } from './pm-plugins/types';
|
|
8
|
-
import type { AnnotationInfo, InlineCommentInputMethod, TargetType } from './types';
|
|
8
|
+
import type { AnnotationInfo, DraftBookmark, InlineCommentInputMethod, TargetType } from './types';
|
|
9
9
|
import { AnnotationSelectionType } from './types';
|
|
10
10
|
export { hasAnnotationMark, containsAnyAnnotations };
|
|
11
11
|
/**
|
|
@@ -14,9 +14,14 @@ export { hasAnnotationMark, containsAnyAnnotations };
|
|
|
14
14
|
*/
|
|
15
15
|
export declare const surroundingMarks: ($pos: ResolvedPos) => (readonly Mark[])[];
|
|
16
16
|
export declare const getAllAnnotations: (doc: Node) => string[];
|
|
17
|
+
export declare const decorationKey: {
|
|
18
|
+
block: string;
|
|
19
|
+
inline: string;
|
|
20
|
+
};
|
|
17
21
|
export declare const addDraftDecoration: (start: number, end: number, targetType?: TargetType) => Decoration;
|
|
18
22
|
export declare const getAnnotationViewKey: (annotations: AnnotationInfo[]) => string;
|
|
19
23
|
export declare const findAnnotationsInSelection: (selection: Selection, doc: Node) => AnnotationInfo[];
|
|
24
|
+
export declare const resolveDraftBookmark: (editorState: EditorState, bookmark: SelectionBookmark, supportedBlockNodes?: string[]) => DraftBookmark;
|
|
20
25
|
/**
|
|
21
26
|
* get selection from position to apply new comment for
|
|
22
27
|
* @return bookmarked positions if they exists, otherwise current selection positions
|
|
@@ -7,7 +7,7 @@ export declare const updateInlineCommentResolvedState: (editorAnalyticsAPI: Edit
|
|
|
7
7
|
export declare const closeComponent: () => Command;
|
|
8
8
|
export declare const clearDirtyMark: () => Command;
|
|
9
9
|
export declare const removeInlineCommentNearSelection: (id: string, supportedNodes?: string[]) => Command;
|
|
10
|
-
export declare const setInlineCommentDraftState: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (drafting: boolean, inputMethod?: InlineCommentInputMethod, targetType?: TargetType, isCommentOnMediaOn?: boolean) => Command;
|
|
10
|
+
export declare const setInlineCommentDraftState: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, supportedBlockNodes?: string[]) => (drafting: boolean, inputMethod?: InlineCommentInputMethod, targetType?: TargetType, isCommentOnMediaOn?: boolean) => Command;
|
|
11
11
|
export declare const addInlineComment: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, editorAPI?: ExtractInjectionAPI<AnnotationPlugin> | undefined) => (id: string) => Command;
|
|
12
12
|
export declare const updateMouseState: (mouseData: InlineCommentMouseData) => Command;
|
|
13
13
|
export declare const setSelectedAnnotation: (id: string) => Command;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import type { Dispatch, EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
3
3
|
import type { PortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
|
|
4
|
+
import type { FeatureFlags } from '@atlaskit/editor-common/types';
|
|
4
5
|
import type { EditorState, SelectionBookmark } from '@atlaskit/editor-prosemirror/state';
|
|
5
6
|
import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
6
7
|
import type { AnnotationInfo, InlineCommentAnnotationProvider, TargetType } from '../types';
|
|
@@ -20,6 +21,7 @@ export interface InlineCommentPluginOptions {
|
|
|
20
21
|
portalProviderAPI: PortalProviderAPI;
|
|
21
22
|
provider: InlineCommentAnnotationProvider;
|
|
22
23
|
editorAnalyticsAPI: EditorAnalyticsAPI | undefined;
|
|
24
|
+
featureFlagsPluginState?: FeatureFlags;
|
|
23
25
|
}
|
|
24
26
|
export interface InlineCommentMouseData {
|
|
25
27
|
isSelecting: boolean;
|
|
@@ -36,6 +38,8 @@ export type InlineCommentAction = {
|
|
|
36
38
|
drafting: boolean;
|
|
37
39
|
editorState: EditorState;
|
|
38
40
|
targetType?: TargetType;
|
|
41
|
+
isCommentOnMediaOn?: boolean;
|
|
42
|
+
supportedBlockNodes?: string[];
|
|
39
43
|
};
|
|
40
44
|
} | {
|
|
41
45
|
type: ACTIONS.INLINE_COMMENT_UPDATE_MOUSE_STATE;
|
|
@@ -76,4 +80,5 @@ export type InlineCommentPluginState = {
|
|
|
76
80
|
isInlineCommentViewClosed: boolean;
|
|
77
81
|
isVisible: boolean;
|
|
78
82
|
skipSelectionHandling: boolean;
|
|
83
|
+
featureFlagsPluginState?: FeatureFlags;
|
|
79
84
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { AnalyticsEventPayloadCallback } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { containsAnyAnnotations, hasAnnotationMark } from '@atlaskit/editor-common/utils';
|
|
3
3
|
import type { Mark, Node, ResolvedPos, Schema, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
4
|
-
import type { EditorState, Selection } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
+
import type { EditorState, Selection, SelectionBookmark } from '@atlaskit/editor-prosemirror/state';
|
|
5
5
|
import { AllSelection, PluginKey, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
6
6
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
7
7
|
import type { InlineCommentPluginState } from './pm-plugins/types';
|
|
8
|
-
import type { AnnotationInfo, InlineCommentInputMethod, TargetType } from './types';
|
|
8
|
+
import type { AnnotationInfo, DraftBookmark, InlineCommentInputMethod, TargetType } from './types';
|
|
9
9
|
import { AnnotationSelectionType } from './types';
|
|
10
10
|
export { hasAnnotationMark, containsAnyAnnotations };
|
|
11
11
|
/**
|
|
@@ -14,9 +14,14 @@ export { hasAnnotationMark, containsAnyAnnotations };
|
|
|
14
14
|
*/
|
|
15
15
|
export declare const surroundingMarks: ($pos: ResolvedPos) => (readonly Mark[])[];
|
|
16
16
|
export declare const getAllAnnotations: (doc: Node) => string[];
|
|
17
|
+
export declare const decorationKey: {
|
|
18
|
+
block: string;
|
|
19
|
+
inline: string;
|
|
20
|
+
};
|
|
17
21
|
export declare const addDraftDecoration: (start: number, end: number, targetType?: TargetType) => Decoration;
|
|
18
22
|
export declare const getAnnotationViewKey: (annotations: AnnotationInfo[]) => string;
|
|
19
23
|
export declare const findAnnotationsInSelection: (selection: Selection, doc: Node) => AnnotationInfo[];
|
|
24
|
+
export declare const resolveDraftBookmark: (editorState: EditorState, bookmark: SelectionBookmark, supportedBlockNodes?: string[]) => DraftBookmark;
|
|
20
25
|
/**
|
|
21
26
|
* get selection from position to apply new comment for
|
|
22
27
|
* @return bookmarked positions if they exists, otherwise current selection positions
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-annotation",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "Annotation plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
".": "./src/index.ts"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@atlaskit/adf-schema": "^35.
|
|
36
|
-
"@atlaskit/editor-common": "^78.
|
|
35
|
+
"@atlaskit/adf-schema": "^35.6.0",
|
|
36
|
+
"@atlaskit/editor-common": "^78.12.0",
|
|
37
37
|
"@atlaskit/editor-plugin-analytics": "^1.0.0",
|
|
38
38
|
"@atlaskit/editor-plugin-editor-viewmode": "^1.0.0",
|
|
39
39
|
"@atlaskit/editor-plugin-feature-flags": "^1.0.0",
|