@atlaskit/editor-plugin-annotation 1.25.0 → 1.25.2
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 +17 -0
- package/dist/cjs/{plugin.js → annotationPlugin.js} +5 -5
- package/dist/cjs/annotationPluginType.js +5 -0
- package/dist/cjs/{commands → editor-commands}/index.js +1 -1
- package/dist/cjs/{commands → editor-commands}/transform.js +1 -1
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/pm-plugins/inline-comment.js +14 -14
- package/dist/cjs/pm-plugins/keymap.js +2 -2
- package/dist/cjs/pm-plugins/plugin-factory.js +1 -1
- package/dist/cjs/pm-plugins/reducer.js +1 -1
- package/dist/cjs/{toolbar.js → pm-plugins/toolbar.js} +3 -3
- package/dist/cjs/{utils.js → pm-plugins/utils.js} +4 -3
- package/dist/cjs/ui/InlineCommentView.js +7 -7
- package/dist/es2019/{plugin.js → annotationPlugin.js} +3 -3
- package/dist/es2019/annotationPluginType.js +1 -0
- package/dist/es2019/{commands → editor-commands}/index.js +1 -1
- package/dist/es2019/{commands → editor-commands}/transform.js +1 -1
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/pm-plugins/inline-comment.js +2 -2
- package/dist/es2019/pm-plugins/keymap.js +1 -1
- package/dist/es2019/pm-plugins/plugin-factory.js +1 -1
- package/dist/es2019/pm-plugins/reducer.js +1 -1
- package/dist/es2019/{toolbar.js → pm-plugins/toolbar.js} +2 -2
- package/dist/es2019/{utils.js → pm-plugins/utils.js} +4 -3
- package/dist/es2019/ui/InlineCommentView.js +2 -2
- package/dist/esm/{plugin.js → annotationPlugin.js} +3 -3
- package/dist/esm/annotationPluginType.js +1 -0
- package/dist/esm/{commands → editor-commands}/index.js +1 -1
- package/dist/esm/{commands → editor-commands}/transform.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/pm-plugins/inline-comment.js +2 -2
- package/dist/esm/pm-plugins/keymap.js +1 -1
- package/dist/esm/pm-plugins/plugin-factory.js +1 -1
- package/dist/esm/pm-plugins/reducer.js +1 -1
- package/dist/esm/{toolbar.js → pm-plugins/toolbar.js} +2 -2
- package/dist/esm/{utils.js → pm-plugins/utils.js} +4 -3
- package/dist/esm/ui/InlineCommentView.js +2 -2
- package/dist/types/{plugin.d.ts → annotationPlugin.d.ts} +2 -1
- package/dist/types/annotationPluginType.d.ts +35 -0
- package/dist/types/{commands → editor-commands}/index.d.ts +2 -1
- package/dist/types/index.d.ts +3 -2
- package/dist/{types-ts4.5 → types/pm-plugins}/toolbar.d.ts +1 -1
- package/dist/types/{utils.d.ts → pm-plugins/utils.d.ts} +5 -5
- package/dist/{types-ts4.5/types.d.ts → types/types/index.d.ts} +0 -33
- package/dist/types/ui/InlineCommentView.d.ts +2 -1
- package/dist/types-ts4.5/{plugin.d.ts → annotationPlugin.d.ts} +2 -1
- package/dist/types-ts4.5/annotationPluginType.d.ts +35 -0
- package/dist/types-ts4.5/{commands → editor-commands}/index.d.ts +2 -1
- package/dist/types-ts4.5/index.d.ts +3 -2
- package/dist/{types → types-ts4.5/pm-plugins}/toolbar.d.ts +1 -1
- package/dist/types-ts4.5/{utils.d.ts → pm-plugins/utils.d.ts} +5 -5
- package/dist/{types/types.d.ts → types-ts4.5/types/index.d.ts} +0 -33
- package/dist/types-ts4.5/ui/InlineCommentView.d.ts +2 -1
- package/package.json +10 -4
- /package/dist/cjs/{types.js → types/index.js} +0 -0
- /package/dist/es2019/{types.js → types/index.js} +0 -0
- /package/dist/esm/{types.js → types/index.js} +0 -0
- /package/dist/types/{commands → editor-commands}/transform.d.ts +0 -0
- /package/dist/types-ts4.5/{commands → editor-commands}/transform.d.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-annotation
|
|
2
2
|
|
|
3
|
+
## 1.25.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#168832](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/168832)
|
|
8
|
+
[`6a5261e14e959`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6a5261e14e959) -
|
|
9
|
+
[ux] ED-25834 allow comment on inline node selection
|
|
10
|
+
|
|
11
|
+
## 1.25.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#167498](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/167498)
|
|
16
|
+
[`e275b9ee8b698`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/e275b9ee8b698) -
|
|
17
|
+
ED-25805: refactors plugins to meet folder standards
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
3
20
|
## 1.25.0
|
|
4
21
|
|
|
5
22
|
### Minor Changes
|
|
@@ -15,12 +15,12 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
15
15
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
16
16
|
var _annotation = require("@atlaskit/editor-common/annotation");
|
|
17
17
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
18
|
-
var
|
|
18
|
+
var _editorCommands = require("./editor-commands");
|
|
19
19
|
var _inlineComment = require("./pm-plugins/inline-comment");
|
|
20
20
|
var _keymap = require("./pm-plugins/keymap");
|
|
21
|
-
var _toolbar = require("./toolbar");
|
|
21
|
+
var _toolbar = require("./pm-plugins/toolbar");
|
|
22
|
+
var _utils = require("./pm-plugins/utils");
|
|
22
23
|
var _InlineCommentView = require("./ui/InlineCommentView");
|
|
23
|
-
var _utils = require("./utils");
|
|
24
24
|
var annotationPlugin = exports.annotationPlugin = function annotationPlugin(_ref) {
|
|
25
25
|
var _api$featureFlags, _api$analytics;
|
|
26
26
|
var annotationProviders = _ref.config,
|
|
@@ -36,8 +36,8 @@ var annotationPlugin = exports.annotationPlugin = function annotationPlugin(_ref
|
|
|
36
36
|
},
|
|
37
37
|
actions: {
|
|
38
38
|
stripNonExistingAnnotations: _utils.stripNonExistingAnnotations,
|
|
39
|
-
setInlineCommentDraftState: (0,
|
|
40
|
-
showCommentForBlockNode: (0,
|
|
39
|
+
setInlineCommentDraftState: (0, _editorCommands.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),
|
|
40
|
+
showCommentForBlockNode: (0, _editorCommands.showInlineCommentForBlockNode)(annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.supportedBlockNodes)
|
|
41
41
|
},
|
|
42
42
|
getSharedState: function getSharedState(editorState) {
|
|
43
43
|
if (!editorState) {
|
|
@@ -11,8 +11,8 @@ var _analytics = require("@atlaskit/editor-common/analytics");
|
|
|
11
11
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
12
12
|
var _pluginFactory = require("../pm-plugins/plugin-factory");
|
|
13
13
|
var _types = require("../pm-plugins/types");
|
|
14
|
+
var _utils = require("../pm-plugins/utils");
|
|
14
15
|
var _types2 = require("../types");
|
|
15
|
-
var _utils = require("../utils");
|
|
16
16
|
var _transform = _interopRequireDefault(require("./transform"));
|
|
17
17
|
var updateInlineCommentResolvedState = exports.updateInlineCommentResolvedState = function updateInlineCommentResolvedState(editorAnalyticsAPI) {
|
|
18
18
|
return function (partialNewState, resolveMethod) {
|
|
@@ -10,7 +10,7 @@ var _mark = require("@atlaskit/editor-common/mark");
|
|
|
10
10
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
11
11
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
12
12
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
|
-
var _utils2 = require("../utils");
|
|
13
|
+
var _utils2 = require("../pm-plugins/utils");
|
|
14
14
|
var addAnnotationMark = function addAnnotationMark(id, supportedBlockNodes) {
|
|
15
15
|
return function (transaction, state) {
|
|
16
16
|
var inlineCommentState = (0, _utils2.getPluginState)(state);
|
package/dist/cjs/index.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
Object.defineProperty(exports, "annotationPlugin", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
get: function get() {
|
|
9
|
-
return
|
|
9
|
+
return _annotationPlugin.annotationPlugin;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
var
|
|
12
|
+
var _annotationPlugin = require("./annotationPlugin");
|
|
@@ -13,10 +13,10 @@ var _analytics = require("@atlaskit/editor-common/analytics");
|
|
|
13
13
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
14
14
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
15
15
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
|
-
var
|
|
16
|
+
var _editorCommands = require("../editor-commands");
|
|
17
17
|
var _nodeviews = require("../nodeviews");
|
|
18
|
-
var _utils = require("../utils");
|
|
19
18
|
var _pluginFactory = require("./plugin-factory");
|
|
19
|
+
var _utils = require("./utils");
|
|
20
20
|
var fetchProviderStates = /*#__PURE__*/function () {
|
|
21
21
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(provider, annotationIds) {
|
|
22
22
|
var data, result;
|
|
@@ -64,7 +64,7 @@ var fetchState = /*#__PURE__*/function () {
|
|
|
64
64
|
case 4:
|
|
65
65
|
inlineCommentStates = _context2.sent;
|
|
66
66
|
if (editorView.dispatch) {
|
|
67
|
-
(0,
|
|
67
|
+
(0, _editorCommands.updateInlineCommentResolvedState)(editorAnalyticsAPI)(inlineCommentStates)(editorView.state, editorView.dispatch);
|
|
68
68
|
}
|
|
69
69
|
case 6:
|
|
70
70
|
case "end":
|
|
@@ -96,7 +96,7 @@ var initialState = function initialState() {
|
|
|
96
96
|
};
|
|
97
97
|
var hideToolbar = function hideToolbar(state, dispatch) {
|
|
98
98
|
return function () {
|
|
99
|
-
(0,
|
|
99
|
+
(0, _editorCommands.updateMouseState)({
|
|
100
100
|
isSelecting: true
|
|
101
101
|
})(state, dispatch);
|
|
102
102
|
};
|
|
@@ -106,14 +106,14 @@ var hideToolbar = function hideToolbar(state, dispatch) {
|
|
|
106
106
|
var onResolve = function onResolve(editorAnalyticsAPI) {
|
|
107
107
|
return function (state, dispatch) {
|
|
108
108
|
return function (annotationId) {
|
|
109
|
-
(0,
|
|
109
|
+
(0, _editorCommands.updateInlineCommentResolvedState)(editorAnalyticsAPI)((0, _defineProperty2.default)({}, annotationId, true), _analytics.RESOLVE_METHOD.CONSUMER)(state, dispatch);
|
|
110
110
|
};
|
|
111
111
|
};
|
|
112
112
|
};
|
|
113
113
|
var onUnResolve = function onUnResolve(editorAnalyticsAPI) {
|
|
114
114
|
return function (state, dispatch) {
|
|
115
115
|
return function (annotationId) {
|
|
116
|
-
(0,
|
|
116
|
+
(0, _editorCommands.updateInlineCommentResolvedState)(editorAnalyticsAPI)((0, _defineProperty2.default)({}, annotationId, false))(state, dispatch);
|
|
117
117
|
};
|
|
118
118
|
};
|
|
119
119
|
};
|
|
@@ -122,7 +122,7 @@ var onMouseUp = function onMouseUp(state, dispatch) {
|
|
|
122
122
|
var _ref3 = (0, _utils.getPluginState)(state) || {},
|
|
123
123
|
mouseData = _ref3.mouseData;
|
|
124
124
|
if (mouseData !== null && mouseData !== void 0 && mouseData.isSelecting) {
|
|
125
|
-
(0,
|
|
125
|
+
(0, _editorCommands.updateMouseState)({
|
|
126
126
|
isSelecting: false
|
|
127
127
|
})(state, dispatch);
|
|
128
128
|
}
|
|
@@ -132,7 +132,7 @@ var onSetVisibility = function onSetVisibility(view) {
|
|
|
132
132
|
return function (isVisible) {
|
|
133
133
|
var state = view.state,
|
|
134
134
|
dispatch = view.dispatch;
|
|
135
|
-
(0,
|
|
135
|
+
(0, _editorCommands.setInlineCommentsVisibility)(isVisible)(state, dispatch);
|
|
136
136
|
if (isVisible) {
|
|
137
137
|
// PM retains focus when we click away from the editor.
|
|
138
138
|
// This will restore the visual aspect of the selection,
|
|
@@ -168,20 +168,20 @@ var inlineCommentPlugin = exports.inlineCommentPlugin = function inlineCommentPl
|
|
|
168
168
|
};
|
|
169
169
|
var setSelectedAnnotationFn = function setSelectedAnnotationFn(annotationId) {
|
|
170
170
|
if (!annotationId) {
|
|
171
|
-
(0,
|
|
171
|
+
(0, _editorCommands.closeComponent)()(editorView.state, editorView.dispatch);
|
|
172
172
|
} else {
|
|
173
|
-
(0,
|
|
173
|
+
(0, _editorCommands.setSelectedAnnotation)(annotationId)(editorView.state, editorView.dispatch);
|
|
174
174
|
}
|
|
175
175
|
};
|
|
176
176
|
var setHoveredAnnotationFn = function setHoveredAnnotationFn(annotationId) {
|
|
177
177
|
if (!annotationId) {
|
|
178
|
-
(0,
|
|
178
|
+
(0, _editorCommands.closeComponent)()(editorView.state, editorView.dispatch);
|
|
179
179
|
} else {
|
|
180
|
-
(0,
|
|
180
|
+
(0, _editorCommands.setHoveredAnnotation)(annotationId)(editorView.state, editorView.dispatch);
|
|
181
181
|
}
|
|
182
182
|
};
|
|
183
183
|
var removeHoveredannotationFn = function removeHoveredannotationFn() {
|
|
184
|
-
(0,
|
|
184
|
+
(0, _editorCommands.setHoveredAnnotation)('')(editorView.state, editorView.dispatch);
|
|
185
185
|
};
|
|
186
186
|
var updateSubscriber = provider.updateSubscriber;
|
|
187
187
|
if (updateSubscriber) {
|
|
@@ -197,7 +197,7 @@ var inlineCommentPlugin = exports.inlineCommentPlugin = function inlineCommentPl
|
|
|
197
197
|
if (!dirtyAnnotations) {
|
|
198
198
|
return;
|
|
199
199
|
}
|
|
200
|
-
(0,
|
|
200
|
+
(0, _editorCommands.clearDirtyMark)()(view.state, view.dispatch);
|
|
201
201
|
fetchState(provider, (0, _utils.getAllAnnotations)(view.state.doc), view, options.editorAnalyticsAPI);
|
|
202
202
|
},
|
|
203
203
|
destroy: function destroy() {
|
|
@@ -7,9 +7,9 @@ exports.keymapPlugin = keymapPlugin;
|
|
|
7
7
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
8
8
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
9
9
|
var _keymap = require("@atlaskit/editor-prosemirror/keymap");
|
|
10
|
-
var
|
|
10
|
+
var _editorCommands = require("../editor-commands");
|
|
11
11
|
function keymapPlugin(editorAnalyticsAPI) {
|
|
12
12
|
var list = {};
|
|
13
|
-
(0, _keymaps.bindKeymapWithCommand)(_keymaps.addInlineComment.common, (0,
|
|
13
|
+
(0, _keymaps.bindKeymapWithCommand)(_keymaps.addInlineComment.common, (0, _editorCommands.setInlineCommentDraftState)(editorAnalyticsAPI)(true, _analytics.INPUT_METHOD.SHORTCUT), list);
|
|
14
14
|
return (0, _keymap.keymap)(list);
|
|
15
15
|
}
|
|
@@ -9,8 +9,8 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
9
9
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
10
10
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
11
11
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
12
|
-
var _utils2 = require("../utils");
|
|
13
12
|
var _reducer = _interopRequireDefault(require("./reducer"));
|
|
13
|
+
var _utils2 = require("./utils");
|
|
14
14
|
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; }
|
|
15
15
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
16
16
|
var handleDocChanged = function handleDocChanged(tr, prevPluginState) {
|
|
@@ -8,8 +8,8 @@ exports.default = void 0;
|
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
11
|
-
var _utils = require("../utils");
|
|
12
11
|
var _types = require("./types");
|
|
12
|
+
var _utils = require("./utils");
|
|
13
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; }
|
|
14
14
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
15
15
|
var _default = exports.default = function _default(pluginState, action) {
|
|
@@ -15,8 +15,8 @@ var _comment = _interopRequireDefault(require("@atlaskit/icon/core/comment"));
|
|
|
15
15
|
var _comment2 = _interopRequireDefault(require("@atlaskit/icon/glyph/comment"));
|
|
16
16
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
17
17
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
18
|
-
var
|
|
19
|
-
var _types = require("
|
|
18
|
+
var _editorCommands = require("../editor-commands");
|
|
19
|
+
var _types = require("../types");
|
|
20
20
|
var _utils2 = require("./utils");
|
|
21
21
|
var INLINE_COMMENT_ON_INLINE_NODE_SPOTLIGHT_EP_MESSAGE_ID = 'inline-comments-on-inline-node-spotlight';
|
|
22
22
|
var createSpotlightConfig = function createSpotlightConfig(_ref) {
|
|
@@ -138,7 +138,7 @@ var buildToolbar = exports.buildToolbar = function buildToolbar(editorAnalyticsA
|
|
|
138
138
|
}
|
|
139
139
|
});
|
|
140
140
|
}
|
|
141
|
-
return (0,
|
|
141
|
+
return (0, _editorCommands.setInlineCommentDraftState)(editorAnalyticsAPI)(true)(state, dispatch);
|
|
142
142
|
},
|
|
143
143
|
supportsViewMode: true,
|
|
144
144
|
// TODO: MODES-3950 Clean up this floating toolbar view mode logic,
|
|
@@ -34,7 +34,7 @@ var _utils = require("@atlaskit/editor-common/utils");
|
|
|
34
34
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
35
35
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
36
36
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
37
|
-
var _types = require("
|
|
37
|
+
var _types = require("../types");
|
|
38
38
|
function sum(arr, f) {
|
|
39
39
|
return arr.reduce(function (val, x) {
|
|
40
40
|
return val + f(x);
|
|
@@ -321,12 +321,13 @@ var isSelectionValid = exports.isSelectionValid = function isSelectionValid(stat
|
|
|
321
321
|
var selection = state.selection;
|
|
322
322
|
var _ref4 = getPluginState(state) || {},
|
|
323
323
|
disallowOnWhitespace = _ref4.disallowOnWhitespace;
|
|
324
|
+
var allowedInlineNodes = ['emoji', 'status', 'date', 'mention', 'inlineCard'];
|
|
324
325
|
|
|
325
326
|
// Allow media so that it can enter draft mode
|
|
326
327
|
if ((_currentMediaNodeWith = (0, _mediaSingle.currentMediaNodeWithPos)(state)) !== null && _currentMediaNodeWith !== void 0 && _currentMediaNodeWith.node) {
|
|
327
328
|
return _types.AnnotationSelectionType.VALID;
|
|
328
329
|
}
|
|
329
|
-
if (selection.empty || !(selection instanceof _state.TextSelection || selection instanceof _state.AllSelection)) {
|
|
330
|
+
if (selection.empty || !(selection instanceof _state.TextSelection || selection instanceof _state.AllSelection || selection instanceof _state.NodeSelection && allowedInlineNodes.includes(selection.node.type.name) && (0, _platformFeatureFlags.fg)('platform_inline_node_as_valid_annotation_selection'))) {
|
|
330
331
|
return _types.AnnotationSelectionType.INVALID;
|
|
331
332
|
}
|
|
332
333
|
var containsInvalidNodes = hasInvalidNodes(state);
|
|
@@ -342,7 +343,7 @@ var isSelectionValid = exports.isSelectionValid = function isSelectionValid(stat
|
|
|
342
343
|
if (disallowOnWhitespace && hasInvalidWhitespaceNode(selection, state.schema)) {
|
|
343
344
|
return _types.AnnotationSelectionType.INVALID;
|
|
344
345
|
}
|
|
345
|
-
if ((0, _utils.isEmptyTextSelection)(selection, state.schema)) {
|
|
346
|
+
if (!(selection instanceof _state.NodeSelection) && (0, _utils.isEmptyTextSelection)(selection, state.schema)) {
|
|
346
347
|
return _types.AnnotationSelectionType.INVALID;
|
|
347
348
|
}
|
|
348
349
|
return _types.AnnotationSelectionType.VALID;
|
|
@@ -11,9 +11,9 @@ var _adfSchema = require("@atlaskit/adf-schema");
|
|
|
11
11
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
12
12
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
13
13
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
14
|
-
var
|
|
14
|
+
var _editorCommands = require("../editor-commands");
|
|
15
|
+
var _utils3 = require("../pm-plugins/utils");
|
|
15
16
|
var _types = require("../types");
|
|
16
|
-
var _utils3 = require("../utils");
|
|
17
17
|
var _AnnotationViewWrapper = require("./AnnotationViewWrapper");
|
|
18
18
|
var findPosForDOM = function findPosForDOM(sel) {
|
|
19
19
|
var $from = sel.$from,
|
|
@@ -98,11 +98,11 @@ function InlineCommentView(_ref) {
|
|
|
98
98
|
dom: dom,
|
|
99
99
|
textSelection: textSelection,
|
|
100
100
|
onCreate: function onCreate(id) {
|
|
101
|
-
(0,
|
|
101
|
+
(0, _editorCommands.createAnnotation)(editorAnalyticsAPI, editorAPI)(id, _adfSchema.AnnotationTypes.INLINE_COMMENT, inlineCommentProvider.supportedBlockNodes)(editorView.state, editorView.dispatch);
|
|
102
102
|
!editorView.hasFocus() && editorView.focus();
|
|
103
103
|
},
|
|
104
104
|
onClose: function onClose() {
|
|
105
|
-
(0,
|
|
105
|
+
(0, _editorCommands.setInlineCommentDraftState)(editorAnalyticsAPI)(false)(editorView.state, editorView.dispatch);
|
|
106
106
|
!editorView.hasFocus() && editorView.focus();
|
|
107
107
|
},
|
|
108
108
|
inlineNodeTypes: inlineNodeTypes,
|
|
@@ -160,13 +160,13 @@ function InlineCommentView(_ref) {
|
|
|
160
160
|
getInlineNodeTypes: getInlineNodeTypes,
|
|
161
161
|
dom: dom,
|
|
162
162
|
onDelete: function onDelete(id) {
|
|
163
|
-
return (0,
|
|
163
|
+
return (0, _editorCommands.removeInlineCommentNearSelection)(id, inlineCommentProvider.supportedBlockNodes)(state, dispatch);
|
|
164
164
|
},
|
|
165
165
|
onResolve: function onResolve(id) {
|
|
166
|
-
return (0,
|
|
166
|
+
return (0, _editorCommands.updateInlineCommentResolvedState)(editorAnalyticsAPI)((0, _defineProperty2.default)({}, id, true), _analytics.RESOLVE_METHOD.COMPONENT)(editorView.state, editorView.dispatch);
|
|
167
167
|
},
|
|
168
168
|
onClose: function onClose() {
|
|
169
|
-
(0,
|
|
169
|
+
(0, _editorCommands.closeComponent)()(editorView.state, editorView.dispatch);
|
|
170
170
|
},
|
|
171
171
|
isOpeningMediaCommentFromToolbar: isOpeningMediaCommentFromToolbar
|
|
172
172
|
}));
|
|
@@ -2,12 +2,12 @@ import React from 'react';
|
|
|
2
2
|
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
|
-
import { setInlineCommentDraftState, showInlineCommentForBlockNode } from './commands';
|
|
5
|
+
import { setInlineCommentDraftState, showInlineCommentForBlockNode } from './editor-commands';
|
|
6
6
|
import { inlineCommentPlugin } from './pm-plugins/inline-comment';
|
|
7
7
|
import { keymapPlugin } from './pm-plugins/keymap';
|
|
8
|
-
import { buildToolbar } from './toolbar';
|
|
8
|
+
import { buildToolbar } from './pm-plugins/toolbar';
|
|
9
|
+
import { getPluginState, stripNonExistingAnnotations } from './pm-plugins/utils';
|
|
9
10
|
import { InlineCommentView } from './ui/InlineCommentView';
|
|
10
|
-
import { getPluginState, stripNonExistingAnnotations } from './utils';
|
|
11
11
|
export const annotationPlugin = ({
|
|
12
12
|
config: annotationProviders,
|
|
13
13
|
api
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -3,8 +3,8 @@ import { INPUT_METHOD, RESOLVE_METHOD } from '@atlaskit/editor-common/analytics'
|
|
|
3
3
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import { createCommand } from '../pm-plugins/plugin-factory';
|
|
5
5
|
import { ACTIONS } from '../pm-plugins/types';
|
|
6
|
+
import { getPluginState, inlineCommentPluginKey, isSelectionValid, isSupportedBlockNode } from '../pm-plugins/utils';
|
|
6
7
|
import { AnnotationSelectionType } from '../types';
|
|
7
|
-
import { getPluginState, inlineCommentPluginKey, isSelectionValid, isSupportedBlockNode } from '../utils';
|
|
8
8
|
import transform from './transform';
|
|
9
9
|
export const updateInlineCommentResolvedState = editorAnalyticsAPI => (partialNewState, resolveMethod) => {
|
|
10
10
|
const command = {
|
|
@@ -4,7 +4,7 @@ import { applyMarkOnRange } from '@atlaskit/editor-common/mark';
|
|
|
4
4
|
import { getRangeInlineNodeNames } from '@atlaskit/editor-common/utils';
|
|
5
5
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
6
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
|
-
import { getDraftCommandAnalyticsPayload, getPluginState, resolveDraftBookmark } from '../utils';
|
|
7
|
+
import { getDraftCommandAnalyticsPayload, getPluginState, resolveDraftBookmark } from '../pm-plugins/utils';
|
|
8
8
|
const addAnnotationMark = (id, supportedBlockNodes) => (transaction, state) => {
|
|
9
9
|
const inlineCommentState = getPluginState(state);
|
|
10
10
|
const {
|
package/dist/es2019/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { annotationPlugin } from './
|
|
1
|
+
export { annotationPlugin } from './annotationPlugin';
|
|
@@ -3,10 +3,10 @@ import { RESOLVE_METHOD } from '@atlaskit/editor-common/analytics';
|
|
|
3
3
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
4
|
import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
|
-
import { clearDirtyMark, closeComponent, setHoveredAnnotation, setInlineCommentsVisibility, setSelectedAnnotation, updateInlineCommentResolvedState, updateMouseState } from '../commands';
|
|
6
|
+
import { clearDirtyMark, closeComponent, setHoveredAnnotation, setInlineCommentsVisibility, setSelectedAnnotation, updateInlineCommentResolvedState, updateMouseState } from '../editor-commands';
|
|
7
7
|
import { AnnotationNodeView, getAnnotationViewClassname, getBlockAnnotationViewClassname } from '../nodeviews';
|
|
8
|
-
import { decorationKey, getAllAnnotations, getPluginState, inlineCommentPluginKey } from '../utils';
|
|
9
8
|
import { createPluginState } from './plugin-factory';
|
|
9
|
+
import { decorationKey, getAllAnnotations, getPluginState, inlineCommentPluginKey } from './utils';
|
|
10
10
|
const fetchProviderStates = async (provider, annotationIds) => {
|
|
11
11
|
const data = await provider.getState(annotationIds);
|
|
12
12
|
let result = {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { addInlineComment, bindKeymapWithCommand } from '@atlaskit/editor-common/keymaps';
|
|
3
3
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
4
|
-
import { setInlineCommentDraftState } from '../commands';
|
|
4
|
+
import { setInlineCommentDraftState } from '../editor-commands';
|
|
5
5
|
export function keymapPlugin(editorAnalyticsAPI) {
|
|
6
6
|
const list = {};
|
|
7
7
|
bindKeymapWithCommand(addInlineComment.common, setInlineCommentDraftState(editorAnalyticsAPI)(true, INPUT_METHOD.SHORTCUT), list);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { pluginFactory } from '@atlaskit/editor-common/utils';
|
|
2
2
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
-
import { decorationKey, findAnnotationsInSelection, inlineCommentPluginKey, isBlockNodeAnnotationsSelected, isSelectedAnnotationsChanged } from '../utils';
|
|
5
4
|
import reducer from './reducer';
|
|
5
|
+
import { decorationKey, findAnnotationsInSelection, inlineCommentPluginKey, isBlockNodeAnnotationsSelected, isSelectedAnnotationsChanged } from './utils';
|
|
6
6
|
const handleDocChanged = (tr, prevPluginState) => {
|
|
7
7
|
if (!tr.getMeta('replaceDocument')) {
|
|
8
8
|
return getSelectionChangedHandler(false)(tr, prevPluginState);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
2
|
-
import { addDraftDecoration, resolveDraftBookmark } from '../utils';
|
|
3
2
|
import { ACTIONS } from './types';
|
|
3
|
+
import { addDraftDecoration, resolveDraftBookmark } from './utils';
|
|
4
4
|
export default ((pluginState, action) => {
|
|
5
5
|
switch (action.type) {
|
|
6
6
|
case ACTIONS.UPDATE_INLINE_COMMENT_STATE:
|
|
@@ -8,8 +8,8 @@ import CommentIcon from '@atlaskit/icon/core/comment';
|
|
|
8
8
|
import LegacyCommentIcon from '@atlaskit/icon/glyph/comment';
|
|
9
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
10
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
11
|
-
import { setInlineCommentDraftState } from '
|
|
12
|
-
import { AnnotationSelectionType, AnnotationTestIds } from '
|
|
11
|
+
import { setInlineCommentDraftState } from '../editor-commands';
|
|
12
|
+
import { AnnotationSelectionType, AnnotationTestIds } from '../types';
|
|
13
13
|
import { getPluginState, isSelectionValid, resolveDraftBookmark } from './utils';
|
|
14
14
|
const INLINE_COMMENT_ON_INLINE_NODE_SPOTLIGHT_EP_MESSAGE_ID = 'inline-comments-on-inline-node-spotlight';
|
|
15
15
|
const createSpotlightConfig = ({
|
|
@@ -6,7 +6,7 @@ import { canApplyAnnotationOnRange, containsAnyAnnotations, getAnnotationIdsFrom
|
|
|
6
6
|
import { AllSelection, NodeSelection, PluginKey, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
7
7
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
|
-
import { AnnotationSelectionType } from '
|
|
9
|
+
import { AnnotationSelectionType } from '../types';
|
|
10
10
|
export { hasAnnotationMark, containsAnyAnnotations };
|
|
11
11
|
function sum(arr, f) {
|
|
12
12
|
return arr.reduce((val, x) => val + f(x), 0);
|
|
@@ -286,12 +286,13 @@ export const isSelectionValid = (state, _supportedNodes = []) => {
|
|
|
286
286
|
const {
|
|
287
287
|
disallowOnWhitespace
|
|
288
288
|
} = getPluginState(state) || {};
|
|
289
|
+
const allowedInlineNodes = ['emoji', 'status', 'date', 'mention', 'inlineCard'];
|
|
289
290
|
|
|
290
291
|
// Allow media so that it can enter draft mode
|
|
291
292
|
if ((_currentMediaNodeWith = currentMediaNodeWithPos(state)) !== null && _currentMediaNodeWith !== void 0 && _currentMediaNodeWith.node) {
|
|
292
293
|
return AnnotationSelectionType.VALID;
|
|
293
294
|
}
|
|
294
|
-
if (selection.empty || !(selection instanceof TextSelection || selection instanceof AllSelection)) {
|
|
295
|
+
if (selection.empty || !(selection instanceof TextSelection || selection instanceof AllSelection || selection instanceof NodeSelection && allowedInlineNodes.includes(selection.node.type.name) && fg('platform_inline_node_as_valid_annotation_selection'))) {
|
|
295
296
|
return AnnotationSelectionType.INVALID;
|
|
296
297
|
}
|
|
297
298
|
const containsInvalidNodes = hasInvalidNodes(state);
|
|
@@ -307,7 +308,7 @@ export const isSelectionValid = (state, _supportedNodes = []) => {
|
|
|
307
308
|
if (disallowOnWhitespace && hasInvalidWhitespaceNode(selection, state.schema)) {
|
|
308
309
|
return AnnotationSelectionType.INVALID;
|
|
309
310
|
}
|
|
310
|
-
if (isEmptyTextSelection(selection, state.schema)) {
|
|
311
|
+
if (!(selection instanceof NodeSelection) && isEmptyTextSelection(selection, state.schema)) {
|
|
311
312
|
return AnnotationSelectionType.INVALID;
|
|
312
313
|
}
|
|
313
314
|
return AnnotationSelectionType.VALID;
|
|
@@ -3,9 +3,9 @@ import { AnnotationTypes } from '@atlaskit/adf-schema';
|
|
|
3
3
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, CONTENT_COMPONENT, EVENT_TYPE, RESOLVE_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { getAnnotationInlineNodeTypes, getRangeInlineNodeNames } from '@atlaskit/editor-common/utils';
|
|
5
5
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
6
|
-
import { closeComponent, createAnnotation, removeInlineCommentNearSelection, setInlineCommentDraftState, updateInlineCommentResolvedState } from '../commands';
|
|
6
|
+
import { closeComponent, createAnnotation, removeInlineCommentNearSelection, setInlineCommentDraftState, updateInlineCommentResolvedState } from '../editor-commands';
|
|
7
|
+
import { getAllAnnotations, getAnnotationViewKey, getPluginState, getSelectionPositions } from '../pm-plugins/utils';
|
|
7
8
|
import { AnnotationTestIds } from '../types';
|
|
8
|
-
import { getAllAnnotations, getAnnotationViewKey, getPluginState, getSelectionPositions } from '../utils';
|
|
9
9
|
import { AnnotationViewWrapper } from './AnnotationViewWrapper';
|
|
10
10
|
const findPosForDOM = sel => {
|
|
11
11
|
const {
|
|
@@ -2,12 +2,12 @@ import React from 'react';
|
|
|
2
2
|
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
|
-
import { setInlineCommentDraftState, showInlineCommentForBlockNode } from './commands';
|
|
5
|
+
import { setInlineCommentDraftState, showInlineCommentForBlockNode } from './editor-commands';
|
|
6
6
|
import { inlineCommentPlugin } from './pm-plugins/inline-comment';
|
|
7
7
|
import { keymapPlugin } from './pm-plugins/keymap';
|
|
8
|
-
import { buildToolbar } from './toolbar';
|
|
8
|
+
import { buildToolbar } from './pm-plugins/toolbar';
|
|
9
|
+
import { getPluginState, stripNonExistingAnnotations } from './pm-plugins/utils';
|
|
9
10
|
import { InlineCommentView } from './ui/InlineCommentView';
|
|
10
|
-
import { getPluginState, stripNonExistingAnnotations } from './utils';
|
|
11
11
|
export var annotationPlugin = function annotationPlugin(_ref) {
|
|
12
12
|
var _api$featureFlags, _api$analytics;
|
|
13
13
|
var annotationProviders = _ref.config,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -4,8 +4,8 @@ import { INPUT_METHOD, RESOLVE_METHOD } from '@atlaskit/editor-common/analytics'
|
|
|
4
4
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
5
5
|
import { createCommand } from '../pm-plugins/plugin-factory';
|
|
6
6
|
import { ACTIONS } from '../pm-plugins/types';
|
|
7
|
+
import { getPluginState, inlineCommentPluginKey, isSelectionValid, isSupportedBlockNode } from '../pm-plugins/utils';
|
|
7
8
|
import { AnnotationSelectionType } from '../types';
|
|
8
|
-
import { getPluginState, inlineCommentPluginKey, isSelectionValid, isSupportedBlockNode } from '../utils';
|
|
9
9
|
import transform from './transform';
|
|
10
10
|
export var updateInlineCommentResolvedState = function updateInlineCommentResolvedState(editorAnalyticsAPI) {
|
|
11
11
|
return function (partialNewState, resolveMethod) {
|
|
@@ -4,7 +4,7 @@ import { applyMarkOnRange } from '@atlaskit/editor-common/mark';
|
|
|
4
4
|
import { getRangeInlineNodeNames } from '@atlaskit/editor-common/utils';
|
|
5
5
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
6
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
|
-
import { getDraftCommandAnalyticsPayload, getPluginState, resolveDraftBookmark } from '../utils';
|
|
7
|
+
import { getDraftCommandAnalyticsPayload, getPluginState, resolveDraftBookmark } from '../pm-plugins/utils';
|
|
8
8
|
var addAnnotationMark = function addAnnotationMark(id, supportedBlockNodes) {
|
|
9
9
|
return function (transaction, state) {
|
|
10
10
|
var inlineCommentState = getPluginState(state);
|
package/dist/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { annotationPlugin } from './
|
|
1
|
+
export { annotationPlugin } from './annotationPlugin';
|
|
@@ -6,10 +6,10 @@ 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
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
|
-
import { clearDirtyMark, closeComponent, setHoveredAnnotation, setInlineCommentsVisibility, setSelectedAnnotation, updateInlineCommentResolvedState, updateMouseState } from '../commands';
|
|
9
|
+
import { clearDirtyMark, closeComponent, setHoveredAnnotation, setInlineCommentsVisibility, setSelectedAnnotation, updateInlineCommentResolvedState, updateMouseState } from '../editor-commands';
|
|
10
10
|
import { AnnotationNodeView, getAnnotationViewClassname, getBlockAnnotationViewClassname } from '../nodeviews';
|
|
11
|
-
import { decorationKey, getAllAnnotations, getPluginState, inlineCommentPluginKey } from '../utils';
|
|
12
11
|
import { createPluginState } from './plugin-factory';
|
|
12
|
+
import { decorationKey, getAllAnnotations, getPluginState, inlineCommentPluginKey } from './utils';
|
|
13
13
|
var fetchProviderStates = /*#__PURE__*/function () {
|
|
14
14
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(provider, annotationIds) {
|
|
15
15
|
var data, result;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { addInlineComment, bindKeymapWithCommand } from '@atlaskit/editor-common/keymaps';
|
|
3
3
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
4
|
-
import { setInlineCommentDraftState } from '../commands';
|
|
4
|
+
import { setInlineCommentDraftState } from '../editor-commands';
|
|
5
5
|
export function keymapPlugin(editorAnalyticsAPI) {
|
|
6
6
|
var list = {};
|
|
7
7
|
bindKeymapWithCommand(addInlineComment.common, setInlineCommentDraftState(editorAnalyticsAPI)(true, INPUT_METHOD.SHORTCUT), list);
|
|
@@ -4,8 +4,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
import { pluginFactory } from '@atlaskit/editor-common/utils';
|
|
5
5
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
6
6
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
7
|
-
import { decorationKey, findAnnotationsInSelection, inlineCommentPluginKey, isBlockNodeAnnotationsSelected, isSelectedAnnotationsChanged } from '../utils';
|
|
8
7
|
import reducer from './reducer';
|
|
8
|
+
import { decorationKey, findAnnotationsInSelection, inlineCommentPluginKey, isBlockNodeAnnotationsSelected, isSelectedAnnotationsChanged } from './utils';
|
|
9
9
|
var handleDocChanged = function handleDocChanged(tr, prevPluginState) {
|
|
10
10
|
if (!tr.getMeta('replaceDocument')) {
|
|
11
11
|
return getSelectionChangedHandler(false)(tr, prevPluginState);
|
|
@@ -3,8 +3,8 @@ 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, resolveDraftBookmark } from '../utils';
|
|
7
6
|
import { ACTIONS } from './types';
|
|
7
|
+
import { addDraftDecoration, resolveDraftBookmark } from './utils';
|
|
8
8
|
export default (function (pluginState, action) {
|
|
9
9
|
switch (action.type) {
|
|
10
10
|
case ACTIONS.UPDATE_INLINE_COMMENT_STATE:
|
|
@@ -8,8 +8,8 @@ import CommentIcon from '@atlaskit/icon/core/comment';
|
|
|
8
8
|
import LegacyCommentIcon from '@atlaskit/icon/glyph/comment';
|
|
9
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
10
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
11
|
-
import { setInlineCommentDraftState } from '
|
|
12
|
-
import { AnnotationSelectionType, AnnotationTestIds } from '
|
|
11
|
+
import { setInlineCommentDraftState } from '../editor-commands';
|
|
12
|
+
import { AnnotationSelectionType, AnnotationTestIds } from '../types';
|
|
13
13
|
import { getPluginState, isSelectionValid, resolveDraftBookmark } from './utils';
|
|
14
14
|
var INLINE_COMMENT_ON_INLINE_NODE_SPOTLIGHT_EP_MESSAGE_ID = 'inline-comments-on-inline-node-spotlight';
|
|
15
15
|
var createSpotlightConfig = function createSpotlightConfig(_ref) {
|
|
@@ -6,7 +6,7 @@ import { canApplyAnnotationOnRange, containsAnyAnnotations, getAnnotationIdsFrom
|
|
|
6
6
|
import { AllSelection, NodeSelection, PluginKey, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
7
7
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
|
-
import { AnnotationSelectionType } from '
|
|
9
|
+
import { AnnotationSelectionType } from '../types';
|
|
10
10
|
export { hasAnnotationMark, containsAnyAnnotations };
|
|
11
11
|
function sum(arr, f) {
|
|
12
12
|
return arr.reduce(function (val, x) {
|
|
@@ -294,12 +294,13 @@ export var isSelectionValid = function isSelectionValid(state) {
|
|
|
294
294
|
var selection = state.selection;
|
|
295
295
|
var _ref4 = getPluginState(state) || {},
|
|
296
296
|
disallowOnWhitespace = _ref4.disallowOnWhitespace;
|
|
297
|
+
var allowedInlineNodes = ['emoji', 'status', 'date', 'mention', 'inlineCard'];
|
|
297
298
|
|
|
298
299
|
// Allow media so that it can enter draft mode
|
|
299
300
|
if ((_currentMediaNodeWith = currentMediaNodeWithPos(state)) !== null && _currentMediaNodeWith !== void 0 && _currentMediaNodeWith.node) {
|
|
300
301
|
return AnnotationSelectionType.VALID;
|
|
301
302
|
}
|
|
302
|
-
if (selection.empty || !(selection instanceof TextSelection || selection instanceof AllSelection)) {
|
|
303
|
+
if (selection.empty || !(selection instanceof TextSelection || selection instanceof AllSelection || selection instanceof NodeSelection && allowedInlineNodes.includes(selection.node.type.name) && fg('platform_inline_node_as_valid_annotation_selection'))) {
|
|
303
304
|
return AnnotationSelectionType.INVALID;
|
|
304
305
|
}
|
|
305
306
|
var containsInvalidNodes = hasInvalidNodes(state);
|
|
@@ -315,7 +316,7 @@ export var isSelectionValid = function isSelectionValid(state) {
|
|
|
315
316
|
if (disallowOnWhitespace && hasInvalidWhitespaceNode(selection, state.schema)) {
|
|
316
317
|
return AnnotationSelectionType.INVALID;
|
|
317
318
|
}
|
|
318
|
-
if (isEmptyTextSelection(selection, state.schema)) {
|
|
319
|
+
if (!(selection instanceof NodeSelection) && isEmptyTextSelection(selection, state.schema)) {
|
|
319
320
|
return AnnotationSelectionType.INVALID;
|
|
320
321
|
}
|
|
321
322
|
return AnnotationSelectionType.VALID;
|
|
@@ -4,9 +4,9 @@ import { AnnotationTypes } from '@atlaskit/adf-schema';
|
|
|
4
4
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, CONTENT_COMPONENT, EVENT_TYPE, RESOLVE_METHOD } from '@atlaskit/editor-common/analytics';
|
|
5
5
|
import { getAnnotationInlineNodeTypes, getRangeInlineNodeNames } from '@atlaskit/editor-common/utils';
|
|
6
6
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
7
|
-
import { closeComponent, createAnnotation, removeInlineCommentNearSelection, setInlineCommentDraftState, updateInlineCommentResolvedState } from '../commands';
|
|
7
|
+
import { closeComponent, createAnnotation, removeInlineCommentNearSelection, setInlineCommentDraftState, updateInlineCommentResolvedState } from '../editor-commands';
|
|
8
|
+
import { getAllAnnotations, getAnnotationViewKey, getPluginState, getSelectionPositions } from '../pm-plugins/utils';
|
|
8
9
|
import { AnnotationTestIds } from '../types';
|
|
9
|
-
import { getAllAnnotations, getAnnotationViewKey, getPluginState, getSelectionPositions } from '../utils';
|
|
10
10
|
import { AnnotationViewWrapper } from './AnnotationViewWrapper';
|
|
11
11
|
var findPosForDOM = function findPosForDOM(sel) {
|
|
12
12
|
var $from = sel.$from,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { UpdateEvent } from '@atlaskit/editor-common/annotation';
|
|
2
2
|
import { AnnotationUpdateEmitter } from '@atlaskit/editor-common/annotation';
|
|
3
|
-
import type {
|
|
3
|
+
import type { AnnotationPlugin } from './annotationPluginType';
|
|
4
|
+
import type { AnnotationInfo, AnnotationProviders, AnnotationState, AnnotationTypeProvider, InlineCommentAnnotationProvider, InlineCommentCreateComponentProps, InlineCommentState, InlineCommentViewComponentProps } from './types';
|
|
4
5
|
export declare const annotationPlugin: AnnotationPlugin;
|
|
5
6
|
export { AnnotationUpdateEmitter };
|
|
6
7
|
export type { AnnotationProviders, InlineCommentAnnotationProvider, InlineCommentCreateComponentProps, InlineCommentViewComponentProps, AnnotationTypeProvider, AnnotationInfo, AnnotationState, InlineCommentState, UpdateEvent, };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Command, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
|
+
import type { EditorViewModeEffectsPlugin } from '@atlaskit/editor-plugin-editor-viewmode-effects';
|
|
4
|
+
import type { EngagementPlatformPlugin } from '@atlaskit/editor-plugin-engagement-platform';
|
|
5
|
+
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
6
|
+
import type { Slice } from '@atlaskit/editor-prosemirror/model';
|
|
7
|
+
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
8
|
+
import type { showInlineCommentForBlockNode } from './editor-commands';
|
|
9
|
+
import type { InlineCommentPluginState } from './pm-plugins/types';
|
|
10
|
+
import type { AnnotationProviders, InlineCommentInputMethod, TargetType } from './types';
|
|
11
|
+
type StripNonExistingAnnotations = (slice: Slice, state: EditorState) => boolean | undefined;
|
|
12
|
+
type SetInlineCommentDraftState = (drafting: boolean, inputMethod: InlineCommentInputMethod,
|
|
13
|
+
/** @default 'inline' */
|
|
14
|
+
targetType?: TargetType, targetNodeId?: string, isOpeningMediaCommentFromToolbar?: boolean) => Command;
|
|
15
|
+
export type AnnotationPlugin = NextEditorPlugin<'annotation', {
|
|
16
|
+
pluginConfiguration: AnnotationProviders | undefined;
|
|
17
|
+
sharedState: InlineCommentPluginState | undefined;
|
|
18
|
+
dependencies: [
|
|
19
|
+
OptionalPlugin<AnalyticsPlugin>,
|
|
20
|
+
OptionalPlugin<EditorViewModeEffectsPlugin>,
|
|
21
|
+
OptionalPlugin<FeatureFlagsPlugin>,
|
|
22
|
+
OptionalPlugin<EngagementPlatformPlugin>
|
|
23
|
+
];
|
|
24
|
+
actions: {
|
|
25
|
+
stripNonExistingAnnotations: StripNonExistingAnnotations;
|
|
26
|
+
setInlineCommentDraftState: SetInlineCommentDraftState;
|
|
27
|
+
/**
|
|
28
|
+
* This function attempts to display the inline comment popup for a given node.
|
|
29
|
+
* @returns A command function that returns true if the given node is supported and has resolved annotation mark(s);
|
|
30
|
+
* otherwise, it will return false.
|
|
31
|
+
*/
|
|
32
|
+
showCommentForBlockNode: ReturnType<typeof showInlineCommentForBlockNode>;
|
|
33
|
+
};
|
|
34
|
+
}>;
|
|
35
|
+
export {};
|
|
@@ -3,8 +3,9 @@ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
|
3
3
|
import { RESOLVE_METHOD, type VIEW_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import type { Command, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
5
5
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
6
|
+
import type { AnnotationPlugin } from '../annotationPluginType';
|
|
6
7
|
import type { InlineCommentMap, InlineCommentMouseData } from '../pm-plugins/types';
|
|
7
|
-
import type {
|
|
8
|
+
import type { InlineCommentInputMethod, TargetType } from '../types';
|
|
8
9
|
export declare const updateInlineCommentResolvedState: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (partialNewState: InlineCommentMap, resolveMethod?: RESOLVE_METHOD) => Command;
|
|
9
10
|
export declare const closeComponent: () => Command;
|
|
10
11
|
export declare const clearDirtyMark: () => Command;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export { annotationPlugin } from './
|
|
2
|
-
export type { AnnotationPlugin
|
|
1
|
+
export { annotationPlugin } from './annotationPlugin';
|
|
2
|
+
export type { AnnotationPlugin } from './annotationPluginType';
|
|
3
|
+
export type { AnnotationProviders, InlineCommentAnnotationProvider, AnnotationInfo, InlineCommentCreateComponentProps, InlineCommentViewComponentProps, AnnotationState, AnnotationTypeProvider, InlineCommentState, TargetType, InlineCommentInputMethod, } from './types';
|
|
3
4
|
export type { InlineCommentMap, InlineCommentPluginState, InlineCommentPluginOptions, InlineCommentAction, } from './pm-plugins/types';
|
|
@@ -2,7 +2,7 @@ import type { IntlShape } from 'react-intl-next';
|
|
|
2
2
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import type { ExtractInjectionAPI, FloatingToolbarConfig } from '@atlaskit/editor-common/types';
|
|
4
4
|
import { type EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
-
import {
|
|
5
|
+
import type { AnnotationPlugin } from '../annotationPluginType';
|
|
6
6
|
interface BuildToolbarOptions {
|
|
7
7
|
state: EditorState;
|
|
8
8
|
intl: IntlShape;
|
|
@@ -2,11 +2,11 @@ import type { AnalyticsEventPayloadCallback } from '@atlaskit/editor-common/anal
|
|
|
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
4
|
import type { EditorState, Selection, SelectionBookmark } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
-
import { AllSelection, PluginKey, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
+
import { AllSelection, NodeSelection, PluginKey, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
6
6
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
7
|
-
import type {
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
7
|
+
import type { AnnotationInfo, DraftBookmark, InlineCommentInputMethod, TargetType } from '../types';
|
|
8
|
+
import { AnnotationSelectionType } from '../types';
|
|
9
|
+
import type { InlineCommentPluginState } from './types';
|
|
10
10
|
export { hasAnnotationMark, containsAnyAnnotations };
|
|
11
11
|
/**
|
|
12
12
|
* Finds the marks in the nodes to the left and right.
|
|
@@ -41,7 +41,7 @@ export declare const isSupportedBlockNode: (node: Node, supportedBlockNodes?: st
|
|
|
41
41
|
* Checks if any of the nodes in a given selection are completely whitespace
|
|
42
42
|
* This is to conform to Confluence annotation specifications
|
|
43
43
|
*/
|
|
44
|
-
export declare function hasInvalidWhitespaceNode(selection: TextSelection | AllSelection, schema: Schema): boolean;
|
|
44
|
+
export declare function hasInvalidWhitespaceNode(selection: TextSelection | AllSelection | NodeSelection, schema: Schema): boolean;
|
|
45
45
|
export declare function annotationExists(annotationId: string, state: EditorState): boolean;
|
|
46
46
|
export declare function stripNonExistingAnnotations(slice: Slice, state: EditorState): false | undefined;
|
|
47
47
|
/**
|
|
@@ -2,16 +2,6 @@ import type React from 'react';
|
|
|
2
2
|
import type { AnnotationTypes } from '@atlaskit/adf-schema';
|
|
3
3
|
import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import type { AnnotationUpdateEmitter } from '@atlaskit/editor-common/annotation';
|
|
5
|
-
import type { Command, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
6
|
-
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
7
|
-
import type { EditorViewModeEffectsPlugin } from '@atlaskit/editor-plugin-editor-viewmode-effects';
|
|
8
|
-
import type { EngagementPlatformPlugin } from '@atlaskit/editor-plugin-engagement-platform';
|
|
9
|
-
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
10
|
-
import type { Slice } from '@atlaskit/editor-prosemirror/model';
|
|
11
|
-
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
12
|
-
import type { showInlineCommentForBlockNode } from './commands';
|
|
13
|
-
import type { InlineCommentPluginState } from './pm-plugins/types';
|
|
14
|
-
type StripNonExistingAnnotations = (slice: Slice, state: EditorState) => boolean | undefined;
|
|
15
5
|
/**
|
|
16
6
|
* type of target that annotation apply to.
|
|
17
7
|
* This is used to apply correct decoration to a draft comment
|
|
@@ -21,29 +11,6 @@ export type TargetType = 'block' | 'inline';
|
|
|
21
11
|
* The source of draft comment being created
|
|
22
12
|
*/
|
|
23
13
|
export type InlineCommentInputMethod = INPUT_METHOD.TOOLBAR | INPUT_METHOD.SHORTCUT | INPUT_METHOD.FLOATING_TB;
|
|
24
|
-
type SetInlineCommentDraftState = (drafting: boolean, inputMethod: InlineCommentInputMethod,
|
|
25
|
-
/** @default 'inline' */
|
|
26
|
-
targetType?: TargetType, targetNodeId?: string, isOpeningMediaCommentFromToolbar?: boolean) => Command;
|
|
27
|
-
export type AnnotationPlugin = NextEditorPlugin<'annotation', {
|
|
28
|
-
pluginConfiguration: AnnotationProviders | undefined;
|
|
29
|
-
sharedState: InlineCommentPluginState | undefined;
|
|
30
|
-
dependencies: [
|
|
31
|
-
OptionalPlugin<AnalyticsPlugin>,
|
|
32
|
-
OptionalPlugin<EditorViewModeEffectsPlugin>,
|
|
33
|
-
OptionalPlugin<FeatureFlagsPlugin>,
|
|
34
|
-
OptionalPlugin<EngagementPlatformPlugin>
|
|
35
|
-
];
|
|
36
|
-
actions: {
|
|
37
|
-
stripNonExistingAnnotations: StripNonExistingAnnotations;
|
|
38
|
-
setInlineCommentDraftState: SetInlineCommentDraftState;
|
|
39
|
-
/**
|
|
40
|
-
* This function attempts to display the inline comment popup for a given node.
|
|
41
|
-
* @returns A command function that returns true if the given node is supported and has resolved annotation mark(s);
|
|
42
|
-
* otherwise, it will return false.
|
|
43
|
-
*/
|
|
44
|
-
showCommentForBlockNode: ReturnType<typeof showInlineCommentForBlockNode>;
|
|
45
|
-
};
|
|
46
|
-
}>;
|
|
47
14
|
export type AnnotationInfo = {
|
|
48
15
|
id: string;
|
|
49
16
|
type: AnnotationTypes.INLINE_COMMENT;
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
import type { DispatchAnalyticsEvent, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
-
import type { AnnotationPlugin
|
|
5
|
+
import type { AnnotationPlugin } from '../annotationPluginType';
|
|
6
|
+
import { type AnnotationProviders } from '../types';
|
|
6
7
|
interface InlineCommentViewProps {
|
|
7
8
|
providers: AnnotationProviders;
|
|
8
9
|
editorView: EditorView;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { UpdateEvent } from '@atlaskit/editor-common/annotation';
|
|
2
2
|
import { AnnotationUpdateEmitter } from '@atlaskit/editor-common/annotation';
|
|
3
|
-
import type {
|
|
3
|
+
import type { AnnotationPlugin } from './annotationPluginType';
|
|
4
|
+
import type { AnnotationInfo, AnnotationProviders, AnnotationState, AnnotationTypeProvider, InlineCommentAnnotationProvider, InlineCommentCreateComponentProps, InlineCommentState, InlineCommentViewComponentProps } from './types';
|
|
4
5
|
export declare const annotationPlugin: AnnotationPlugin;
|
|
5
6
|
export { AnnotationUpdateEmitter };
|
|
6
7
|
export type { AnnotationProviders, InlineCommentAnnotationProvider, InlineCommentCreateComponentProps, InlineCommentViewComponentProps, AnnotationTypeProvider, AnnotationInfo, AnnotationState, InlineCommentState, UpdateEvent, };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Command, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
|
+
import type { EditorViewModeEffectsPlugin } from '@atlaskit/editor-plugin-editor-viewmode-effects';
|
|
4
|
+
import type { EngagementPlatformPlugin } from '@atlaskit/editor-plugin-engagement-platform';
|
|
5
|
+
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
6
|
+
import type { Slice } from '@atlaskit/editor-prosemirror/model';
|
|
7
|
+
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
8
|
+
import type { showInlineCommentForBlockNode } from './editor-commands';
|
|
9
|
+
import type { InlineCommentPluginState } from './pm-plugins/types';
|
|
10
|
+
import type { AnnotationProviders, InlineCommentInputMethod, TargetType } from './types';
|
|
11
|
+
type StripNonExistingAnnotations = (slice: Slice, state: EditorState) => boolean | undefined;
|
|
12
|
+
type SetInlineCommentDraftState = (drafting: boolean, inputMethod: InlineCommentInputMethod,
|
|
13
|
+
/** @default 'inline' */
|
|
14
|
+
targetType?: TargetType, targetNodeId?: string, isOpeningMediaCommentFromToolbar?: boolean) => Command;
|
|
15
|
+
export type AnnotationPlugin = NextEditorPlugin<'annotation', {
|
|
16
|
+
pluginConfiguration: AnnotationProviders | undefined;
|
|
17
|
+
sharedState: InlineCommentPluginState | undefined;
|
|
18
|
+
dependencies: [
|
|
19
|
+
OptionalPlugin<AnalyticsPlugin>,
|
|
20
|
+
OptionalPlugin<EditorViewModeEffectsPlugin>,
|
|
21
|
+
OptionalPlugin<FeatureFlagsPlugin>,
|
|
22
|
+
OptionalPlugin<EngagementPlatformPlugin>
|
|
23
|
+
];
|
|
24
|
+
actions: {
|
|
25
|
+
stripNonExistingAnnotations: StripNonExistingAnnotations;
|
|
26
|
+
setInlineCommentDraftState: SetInlineCommentDraftState;
|
|
27
|
+
/**
|
|
28
|
+
* This function attempts to display the inline comment popup for a given node.
|
|
29
|
+
* @returns A command function that returns true if the given node is supported and has resolved annotation mark(s);
|
|
30
|
+
* otherwise, it will return false.
|
|
31
|
+
*/
|
|
32
|
+
showCommentForBlockNode: ReturnType<typeof showInlineCommentForBlockNode>;
|
|
33
|
+
};
|
|
34
|
+
}>;
|
|
35
|
+
export {};
|
|
@@ -3,8 +3,9 @@ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
|
3
3
|
import { RESOLVE_METHOD, type VIEW_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import type { Command, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
5
5
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
6
|
+
import type { AnnotationPlugin } from '../annotationPluginType';
|
|
6
7
|
import type { InlineCommentMap, InlineCommentMouseData } from '../pm-plugins/types';
|
|
7
|
-
import type {
|
|
8
|
+
import type { InlineCommentInputMethod, TargetType } from '../types';
|
|
8
9
|
export declare const updateInlineCommentResolvedState: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (partialNewState: InlineCommentMap, resolveMethod?: RESOLVE_METHOD) => Command;
|
|
9
10
|
export declare const closeComponent: () => Command;
|
|
10
11
|
export declare const clearDirtyMark: () => Command;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export { annotationPlugin } from './
|
|
2
|
-
export type { AnnotationPlugin
|
|
1
|
+
export { annotationPlugin } from './annotationPlugin';
|
|
2
|
+
export type { AnnotationPlugin } from './annotationPluginType';
|
|
3
|
+
export type { AnnotationProviders, InlineCommentAnnotationProvider, AnnotationInfo, InlineCommentCreateComponentProps, InlineCommentViewComponentProps, AnnotationState, AnnotationTypeProvider, InlineCommentState, TargetType, InlineCommentInputMethod, } from './types';
|
|
3
4
|
export type { InlineCommentMap, InlineCommentPluginState, InlineCommentPluginOptions, InlineCommentAction, } from './pm-plugins/types';
|
|
@@ -2,7 +2,7 @@ import type { IntlShape } from 'react-intl-next';
|
|
|
2
2
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import type { ExtractInjectionAPI, FloatingToolbarConfig } from '@atlaskit/editor-common/types';
|
|
4
4
|
import { type EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
-
import {
|
|
5
|
+
import type { AnnotationPlugin } from '../annotationPluginType';
|
|
6
6
|
interface BuildToolbarOptions {
|
|
7
7
|
state: EditorState;
|
|
8
8
|
intl: IntlShape;
|
|
@@ -2,11 +2,11 @@ import type { AnalyticsEventPayloadCallback } from '@atlaskit/editor-common/anal
|
|
|
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
4
|
import type { EditorState, Selection, SelectionBookmark } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
-
import { AllSelection, PluginKey, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
+
import { AllSelection, NodeSelection, PluginKey, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
6
6
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
7
|
-
import type {
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
7
|
+
import type { AnnotationInfo, DraftBookmark, InlineCommentInputMethod, TargetType } from '../types';
|
|
8
|
+
import { AnnotationSelectionType } from '../types';
|
|
9
|
+
import type { InlineCommentPluginState } from './types';
|
|
10
10
|
export { hasAnnotationMark, containsAnyAnnotations };
|
|
11
11
|
/**
|
|
12
12
|
* Finds the marks in the nodes to the left and right.
|
|
@@ -41,7 +41,7 @@ export declare const isSupportedBlockNode: (node: Node, supportedBlockNodes?: st
|
|
|
41
41
|
* Checks if any of the nodes in a given selection are completely whitespace
|
|
42
42
|
* This is to conform to Confluence annotation specifications
|
|
43
43
|
*/
|
|
44
|
-
export declare function hasInvalidWhitespaceNode(selection: TextSelection | AllSelection, schema: Schema): boolean;
|
|
44
|
+
export declare function hasInvalidWhitespaceNode(selection: TextSelection | AllSelection | NodeSelection, schema: Schema): boolean;
|
|
45
45
|
export declare function annotationExists(annotationId: string, state: EditorState): boolean;
|
|
46
46
|
export declare function stripNonExistingAnnotations(slice: Slice, state: EditorState): false | undefined;
|
|
47
47
|
/**
|
|
@@ -2,16 +2,6 @@ import type React from 'react';
|
|
|
2
2
|
import type { AnnotationTypes } from '@atlaskit/adf-schema';
|
|
3
3
|
import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import type { AnnotationUpdateEmitter } from '@atlaskit/editor-common/annotation';
|
|
5
|
-
import type { Command, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
6
|
-
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
7
|
-
import type { EditorViewModeEffectsPlugin } from '@atlaskit/editor-plugin-editor-viewmode-effects';
|
|
8
|
-
import type { EngagementPlatformPlugin } from '@atlaskit/editor-plugin-engagement-platform';
|
|
9
|
-
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
10
|
-
import type { Slice } from '@atlaskit/editor-prosemirror/model';
|
|
11
|
-
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
12
|
-
import type { showInlineCommentForBlockNode } from './commands';
|
|
13
|
-
import type { InlineCommentPluginState } from './pm-plugins/types';
|
|
14
|
-
type StripNonExistingAnnotations = (slice: Slice, state: EditorState) => boolean | undefined;
|
|
15
5
|
/**
|
|
16
6
|
* type of target that annotation apply to.
|
|
17
7
|
* This is used to apply correct decoration to a draft comment
|
|
@@ -21,29 +11,6 @@ export type TargetType = 'block' | 'inline';
|
|
|
21
11
|
* The source of draft comment being created
|
|
22
12
|
*/
|
|
23
13
|
export type InlineCommentInputMethod = INPUT_METHOD.TOOLBAR | INPUT_METHOD.SHORTCUT | INPUT_METHOD.FLOATING_TB;
|
|
24
|
-
type SetInlineCommentDraftState = (drafting: boolean, inputMethod: InlineCommentInputMethod,
|
|
25
|
-
/** @default 'inline' */
|
|
26
|
-
targetType?: TargetType, targetNodeId?: string, isOpeningMediaCommentFromToolbar?: boolean) => Command;
|
|
27
|
-
export type AnnotationPlugin = NextEditorPlugin<'annotation', {
|
|
28
|
-
pluginConfiguration: AnnotationProviders | undefined;
|
|
29
|
-
sharedState: InlineCommentPluginState | undefined;
|
|
30
|
-
dependencies: [
|
|
31
|
-
OptionalPlugin<AnalyticsPlugin>,
|
|
32
|
-
OptionalPlugin<EditorViewModeEffectsPlugin>,
|
|
33
|
-
OptionalPlugin<FeatureFlagsPlugin>,
|
|
34
|
-
OptionalPlugin<EngagementPlatformPlugin>
|
|
35
|
-
];
|
|
36
|
-
actions: {
|
|
37
|
-
stripNonExistingAnnotations: StripNonExistingAnnotations;
|
|
38
|
-
setInlineCommentDraftState: SetInlineCommentDraftState;
|
|
39
|
-
/**
|
|
40
|
-
* This function attempts to display the inline comment popup for a given node.
|
|
41
|
-
* @returns A command function that returns true if the given node is supported and has resolved annotation mark(s);
|
|
42
|
-
* otherwise, it will return false.
|
|
43
|
-
*/
|
|
44
|
-
showCommentForBlockNode: ReturnType<typeof showInlineCommentForBlockNode>;
|
|
45
|
-
};
|
|
46
|
-
}>;
|
|
47
14
|
export type AnnotationInfo = {
|
|
48
15
|
id: string;
|
|
49
16
|
type: AnnotationTypes.INLINE_COMMENT;
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
import type { DispatchAnalyticsEvent, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
-
import type { AnnotationPlugin
|
|
5
|
+
import type { AnnotationPlugin } from '../annotationPluginType';
|
|
6
|
+
import { type AnnotationProviders } from '../types';
|
|
6
7
|
interface InlineCommentViewProps {
|
|
7
8
|
providers: AnnotationProviders;
|
|
8
9
|
editorView: EditorView;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-annotation",
|
|
3
|
-
"version": "1.25.
|
|
3
|
+
"version": "1.25.2",
|
|
4
4
|
"description": "Annotation plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,16 +32,16 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/adf-schema": "^44.2.0",
|
|
35
|
-
"@atlaskit/editor-common": "^95.
|
|
35
|
+
"@atlaskit/editor-common": "^95.6.0",
|
|
36
36
|
"@atlaskit/editor-plugin-analytics": "^1.10.0",
|
|
37
37
|
"@atlaskit/editor-plugin-editor-viewmode-effects": "^1.1.0",
|
|
38
38
|
"@atlaskit/editor-plugin-engagement-platform": "^2.1.0",
|
|
39
39
|
"@atlaskit/editor-plugin-feature-flags": "^1.2.0",
|
|
40
40
|
"@atlaskit/editor-prosemirror": "6.0.0",
|
|
41
|
-
"@atlaskit/icon": "^22.
|
|
41
|
+
"@atlaskit/icon": "^22.26.0",
|
|
42
42
|
"@atlaskit/onboarding": "^12.1.0",
|
|
43
43
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
44
|
-
"@atlaskit/tmp-editor-statsig": "^2.
|
|
44
|
+
"@atlaskit/tmp-editor-statsig": "^2.21.0",
|
|
45
45
|
"@babel/runtime": "^7.0.0"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
@@ -59,6 +59,9 @@
|
|
|
59
59
|
},
|
|
60
60
|
"techstack": {
|
|
61
61
|
"@atlassian/frontend": {
|
|
62
|
+
"code-structure": [
|
|
63
|
+
"editor-plugin"
|
|
64
|
+
],
|
|
62
65
|
"import-structure": [
|
|
63
66
|
"atlassian-conventions"
|
|
64
67
|
],
|
|
@@ -96,6 +99,9 @@
|
|
|
96
99
|
},
|
|
97
100
|
"editor_inline_comments_on_inline_nodes_spotlight": {
|
|
98
101
|
"type": "boolean"
|
|
102
|
+
},
|
|
103
|
+
"platform_inline_node_as_valid_annotation_selection": {
|
|
104
|
+
"type": "boolean"
|
|
99
105
|
}
|
|
100
106
|
}
|
|
101
107
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|