@atlaskit/editor-plugin-annotation 1.3.1 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/cjs/pm-plugins/inline-comment.js +21 -8
- package/dist/cjs/utils.js +18 -2
- package/dist/es2019/pm-plugins/inline-comment.js +20 -7
- package/dist/es2019/utils.js +19 -1
- package/dist/esm/pm-plugins/inline-comment.js +22 -9
- package/dist/esm/utils.js +17 -1
- package/dist/types/types.d.ts +2 -2
- package/dist/types/utils.d.ts +1 -0
- package/dist/types-ts4.5/types.d.ts +2 -2
- package/dist/types-ts4.5/utils.d.ts +1 -0
- package/package.json +8 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-annotation
|
|
2
2
|
|
|
3
|
+
## 1.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#81394](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/81394) [`2798f5546fb7`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/2798f5546fb7) - [ux] ED-22118 implemented annotation style for block node (media)
|
|
8
|
+
|
|
9
|
+
## 1.3.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#79543](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/79543) [`8b578f7427a2`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8b578f7427a2) - ED-22502: updated range selection check to exempt inline card, to allow them to have annotation marks
|
|
14
|
+
- [#80883](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/80883) [`5ecfa883d4ba`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/5ecfa883d4ba) - React 18 types for alignment, annotation, avatar-group and blocktype plugins.
|
|
15
|
+
|
|
3
16
|
## 1.3.1
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -11,6 +11,7 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
|
|
|
11
11
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
12
12
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
13
13
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
14
|
+
var _styles = require("@atlaskit/editor-common/styles");
|
|
14
15
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
15
16
|
var _commands = require("../commands");
|
|
16
17
|
var _nodeviews = require("../nodeviews");
|
|
@@ -223,18 +224,30 @@ var inlineCommentPlugin = exports.inlineCommentPlugin = function inlineCommentPl
|
|
|
223
224
|
var decorations = draftDecorationSet !== null && draftDecorationSet !== void 0 ? draftDecorationSet : _view.DecorationSet.empty;
|
|
224
225
|
var focusDecorations = [];
|
|
225
226
|
state.doc.descendants(function (node, pos) {
|
|
227
|
+
var _provider$supportedBl;
|
|
228
|
+
var isSupportedBlockNode = node.isBlock && ((_provider$supportedBl = provider.supportedBlockNodes) === null || _provider$supportedBl === void 0 ? void 0 : _provider$supportedBl.includes(node.type.name));
|
|
226
229
|
node.marks.filter(function (mark) {
|
|
227
230
|
return mark.type === state.schema.marks.annotation;
|
|
228
231
|
}).forEach(function (mark) {
|
|
229
|
-
var isSelected = !isInlineCommentViewClosed && !!(selectedAnnotations !== null && selectedAnnotations !== void 0 && selectedAnnotations.some(function (selectedAnnotation) {
|
|
230
|
-
return selectedAnnotation.id === mark.attrs.id;
|
|
231
|
-
}));
|
|
232
|
-
var isUnresolved = !!annotations && annotations[mark.attrs.id] === false;
|
|
233
232
|
if (isVisible) {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
233
|
+
var isUnresolved = !!annotations && annotations[mark.attrs.id] === false;
|
|
234
|
+
if (isSupportedBlockNode) {
|
|
235
|
+
var isBlockNodeSelected = (0, _utils.isCurrentBlockNodeSelected)(state, node);
|
|
236
|
+
var attrs = isUnresolved ? {
|
|
237
|
+
class: isBlockNodeSelected ? "".concat(_styles.BlockAnnotationSharedClassNames.focus) : "".concat(_styles.BlockAnnotationSharedClassNames.blur)
|
|
238
|
+
} : {};
|
|
239
|
+
focusDecorations.push(_view.Decoration.node(pos, pos + node.nodeSize, attrs, {
|
|
240
|
+
key: _utils.decorationKey.block
|
|
241
|
+
}));
|
|
242
|
+
} else {
|
|
243
|
+
var isSelected = !isInlineCommentViewClosed && !!(selectedAnnotations !== null && selectedAnnotations !== void 0 && selectedAnnotations.some(function (selectedAnnotation) {
|
|
244
|
+
return selectedAnnotation.id === mark.attrs.id;
|
|
245
|
+
}));
|
|
246
|
+
focusDecorations.push(_view.Decoration.inline(pos, pos + node.nodeSize, {
|
|
247
|
+
class: "".concat((0, _nodeviews.getAnnotationViewClassname)(isUnresolved, isSelected), " ").concat(isUnresolved),
|
|
248
|
+
nodeName: 'span'
|
|
249
|
+
}));
|
|
250
|
+
}
|
|
238
251
|
}
|
|
239
252
|
});
|
|
240
253
|
});
|
package/dist/cjs/utils.js
CHANGED
|
@@ -21,7 +21,7 @@ Object.defineProperty(exports, "hasAnnotationMark", {
|
|
|
21
21
|
});
|
|
22
22
|
exports.hasInvalidNodes = void 0;
|
|
23
23
|
exports.hasInvalidWhitespaceNode = hasInvalidWhitespaceNode;
|
|
24
|
-
exports.inlineCommentPluginKey = void 0;
|
|
24
|
+
exports.isCurrentBlockNodeSelected = exports.inlineCommentPluginKey = void 0;
|
|
25
25
|
exports.isSelectedAnnotationsChanged = isSelectedAnnotationsChanged;
|
|
26
26
|
exports.resolveDraftBookmark = exports.isSupportedBlockNode = exports.isSelectionValid = void 0;
|
|
27
27
|
exports.stripNonExistingAnnotations = stripNonExistingAnnotations;
|
|
@@ -33,6 +33,7 @@ var _styles = require("@atlaskit/editor-common/styles");
|
|
|
33
33
|
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
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
36
37
|
var _types = require("./types");
|
|
37
38
|
function sum(arr, f) {
|
|
38
39
|
return arr.reduce(function (val, x) {
|
|
@@ -154,6 +155,18 @@ var getAnnotationViewKey = exports.getAnnotationViewKey = function getAnnotation
|
|
|
154
155
|
}).join('_');
|
|
155
156
|
return "view-annotation-wrapper_".concat(keys);
|
|
156
157
|
};
|
|
158
|
+
var isCurrentBlockNodeSelected = exports.isCurrentBlockNodeSelected = function isCurrentBlockNodeSelected(state, node) {
|
|
159
|
+
var selection = state.selection;
|
|
160
|
+
if (selection instanceof _state.NodeSelection) {
|
|
161
|
+
if (selection.node === node) {
|
|
162
|
+
return true;
|
|
163
|
+
}
|
|
164
|
+
if (node.type.name === 'media' && selection.node.firstChild === node) {
|
|
165
|
+
return true;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return false;
|
|
169
|
+
};
|
|
157
170
|
var findAnnotationsInSelection = exports.findAnnotationsInSelection = function findAnnotationsInSelection(selection, doc) {
|
|
158
171
|
var empty = selection.empty,
|
|
159
172
|
$anchor = selection.$anchor,
|
|
@@ -168,7 +181,7 @@ var findAnnotationsInSelection = exports.findAnnotationsInSelection = function f
|
|
|
168
181
|
}
|
|
169
182
|
var annotationMark = doc.type.schema.marks.annotation;
|
|
170
183
|
var nodeBefore = $anchor.nodeBefore;
|
|
171
|
-
var anchorAnnotationMarks = node
|
|
184
|
+
var anchorAnnotationMarks = (node === null || node === void 0 ? void 0 : node.marks) || [];
|
|
172
185
|
var marks = [];
|
|
173
186
|
if (annotationMark.isInSet(anchorAnnotationMarks)) {
|
|
174
187
|
marks = anchorAnnotationMarks;
|
|
@@ -353,6 +366,9 @@ function hasInvalidWhitespaceNode(selection, schema) {
|
|
|
353
366
|
var foundInvalidWhitespace = false;
|
|
354
367
|
var content = selection.content().content;
|
|
355
368
|
content.descendants(function (node) {
|
|
369
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.allow-inline-comments-for-inline-nodes') && node.type === schema.nodes.inlineCard) {
|
|
370
|
+
return false;
|
|
371
|
+
}
|
|
356
372
|
if ((0, _utils.isText)(node, schema)) {
|
|
357
373
|
return false;
|
|
358
374
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { AnnotationTypes } from '@atlaskit/adf-schema';
|
|
2
2
|
import { RESOLVE_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
|
+
import { BlockAnnotationSharedClassNames } from '@atlaskit/editor-common/styles';
|
|
4
5
|
import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
5
6
|
import { clearDirtyMark, closeComponent, setInlineCommentsVisibility, setSelectedAnnotation, updateInlineCommentResolvedState, updateMouseState } from '../commands';
|
|
6
7
|
import { AnnotationNodeView, getAnnotationViewClassname } from '../nodeviews';
|
|
7
|
-
import { getAllAnnotations, getPluginState, inlineCommentPluginKey } from '../utils';
|
|
8
|
+
import { decorationKey, getAllAnnotations, getPluginState, inlineCommentPluginKey, isCurrentBlockNodeSelected } from '../utils';
|
|
8
9
|
import { createPluginState } from './plugin-factory';
|
|
9
10
|
const fetchProviderStates = async (provider, annotationIds) => {
|
|
10
11
|
const data = await provider.getState(annotationIds);
|
|
@@ -163,14 +164,26 @@ export const inlineCommentPlugin = options => {
|
|
|
163
164
|
let decorations = draftDecorationSet !== null && draftDecorationSet !== void 0 ? draftDecorationSet : DecorationSet.empty;
|
|
164
165
|
const focusDecorations = [];
|
|
165
166
|
state.doc.descendants((node, pos) => {
|
|
167
|
+
var _provider$supportedBl;
|
|
168
|
+
const isSupportedBlockNode = node.isBlock && ((_provider$supportedBl = provider.supportedBlockNodes) === null || _provider$supportedBl === void 0 ? void 0 : _provider$supportedBl.includes(node.type.name));
|
|
166
169
|
node.marks.filter(mark => mark.type === state.schema.marks.annotation).forEach(mark => {
|
|
167
|
-
const isSelected = !isInlineCommentViewClosed && !!(selectedAnnotations !== null && selectedAnnotations !== void 0 && selectedAnnotations.some(selectedAnnotation => selectedAnnotation.id === mark.attrs.id));
|
|
168
|
-
const isUnresolved = !!annotations && annotations[mark.attrs.id] === false;
|
|
169
170
|
if (isVisible) {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
171
|
+
const isUnresolved = !!annotations && annotations[mark.attrs.id] === false;
|
|
172
|
+
if (isSupportedBlockNode) {
|
|
173
|
+
const isBlockNodeSelected = isCurrentBlockNodeSelected(state, node);
|
|
174
|
+
const attrs = isUnresolved ? {
|
|
175
|
+
class: isBlockNodeSelected ? `${BlockAnnotationSharedClassNames.focus}` : `${BlockAnnotationSharedClassNames.blur}`
|
|
176
|
+
} : {};
|
|
177
|
+
focusDecorations.push(Decoration.node(pos, pos + node.nodeSize, attrs, {
|
|
178
|
+
key: decorationKey.block
|
|
179
|
+
}));
|
|
180
|
+
} else {
|
|
181
|
+
const isSelected = !isInlineCommentViewClosed && !!(selectedAnnotations !== null && selectedAnnotations !== void 0 && selectedAnnotations.some(selectedAnnotation => selectedAnnotation.id === mark.attrs.id));
|
|
182
|
+
focusDecorations.push(Decoration.inline(pos, pos + node.nodeSize, {
|
|
183
|
+
class: `${getAnnotationViewClassname(isUnresolved, isSelected)} ${isUnresolved}`,
|
|
184
|
+
nodeName: 'span'
|
|
185
|
+
}));
|
|
186
|
+
}
|
|
174
187
|
}
|
|
175
188
|
});
|
|
176
189
|
});
|
package/dist/es2019/utils.js
CHANGED
|
@@ -5,6 +5,7 @@ import { AnnotationSharedClassNames, BlockAnnotationSharedClassNames } from '@at
|
|
|
5
5
|
import { canApplyAnnotationOnRange, containsAnyAnnotations, getAnnotationIdsFromRange, hasAnnotationMark, isParagraph, isText } from '@atlaskit/editor-common/utils';
|
|
6
6
|
import { AllSelection, NodeSelection, PluginKey, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
7
7
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
8
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
8
9
|
import { AnnotationSelectionType } from './types';
|
|
9
10
|
export { hasAnnotationMark, containsAnyAnnotations };
|
|
10
11
|
function sum(arr, f) {
|
|
@@ -113,6 +114,20 @@ export const getAnnotationViewKey = annotations => {
|
|
|
113
114
|
const keys = annotations.map(mark => mark.id).join('_');
|
|
114
115
|
return `view-annotation-wrapper_${keys}`;
|
|
115
116
|
};
|
|
117
|
+
export const isCurrentBlockNodeSelected = (state, node) => {
|
|
118
|
+
const {
|
|
119
|
+
selection
|
|
120
|
+
} = state;
|
|
121
|
+
if (selection instanceof NodeSelection) {
|
|
122
|
+
if (selection.node === node) {
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
if (node.type.name === 'media' && selection.node.firstChild === node) {
|
|
126
|
+
return true;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return false;
|
|
130
|
+
};
|
|
116
131
|
export const findAnnotationsInSelection = (selection, doc) => {
|
|
117
132
|
const {
|
|
118
133
|
empty,
|
|
@@ -129,7 +144,7 @@ export const findAnnotationsInSelection = (selection, doc) => {
|
|
|
129
144
|
}
|
|
130
145
|
const annotationMark = doc.type.schema.marks.annotation;
|
|
131
146
|
const nodeBefore = $anchor.nodeBefore;
|
|
132
|
-
const anchorAnnotationMarks = node
|
|
147
|
+
const anchorAnnotationMarks = (node === null || node === void 0 ? void 0 : node.marks) || [];
|
|
133
148
|
let marks = [];
|
|
134
149
|
if (annotationMark.isInSet(anchorAnnotationMarks)) {
|
|
135
150
|
marks = anchorAnnotationMarks;
|
|
@@ -319,6 +334,9 @@ export function hasInvalidWhitespaceNode(selection, schema) {
|
|
|
319
334
|
let foundInvalidWhitespace = false;
|
|
320
335
|
const content = selection.content().content;
|
|
321
336
|
content.descendants(node => {
|
|
337
|
+
if (getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes') && node.type === schema.nodes.inlineCard) {
|
|
338
|
+
return false;
|
|
339
|
+
}
|
|
322
340
|
if (isText(node, schema)) {
|
|
323
341
|
return false;
|
|
324
342
|
}
|
|
@@ -4,10 +4,11 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
4
4
|
import { AnnotationTypes } from '@atlaskit/adf-schema';
|
|
5
5
|
import { RESOLVE_METHOD } from '@atlaskit/editor-common/analytics';
|
|
6
6
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
7
|
+
import { BlockAnnotationSharedClassNames } from '@atlaskit/editor-common/styles';
|
|
7
8
|
import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
8
9
|
import { clearDirtyMark, closeComponent, setInlineCommentsVisibility, setSelectedAnnotation, updateInlineCommentResolvedState, updateMouseState } from '../commands';
|
|
9
10
|
import { AnnotationNodeView, getAnnotationViewClassname } from '../nodeviews';
|
|
10
|
-
import { getAllAnnotations, getPluginState, inlineCommentPluginKey } from '../utils';
|
|
11
|
+
import { decorationKey, getAllAnnotations, getPluginState, inlineCommentPluginKey, isCurrentBlockNodeSelected } from '../utils';
|
|
11
12
|
import { createPluginState } from './plugin-factory';
|
|
12
13
|
var fetchProviderStates = /*#__PURE__*/function () {
|
|
13
14
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(provider, annotationIds) {
|
|
@@ -216,18 +217,30 @@ export var inlineCommentPlugin = function inlineCommentPlugin(options) {
|
|
|
216
217
|
var decorations = draftDecorationSet !== null && draftDecorationSet !== void 0 ? draftDecorationSet : DecorationSet.empty;
|
|
217
218
|
var focusDecorations = [];
|
|
218
219
|
state.doc.descendants(function (node, pos) {
|
|
220
|
+
var _provider$supportedBl;
|
|
221
|
+
var isSupportedBlockNode = node.isBlock && ((_provider$supportedBl = provider.supportedBlockNodes) === null || _provider$supportedBl === void 0 ? void 0 : _provider$supportedBl.includes(node.type.name));
|
|
219
222
|
node.marks.filter(function (mark) {
|
|
220
223
|
return mark.type === state.schema.marks.annotation;
|
|
221
224
|
}).forEach(function (mark) {
|
|
222
|
-
var isSelected = !isInlineCommentViewClosed && !!(selectedAnnotations !== null && selectedAnnotations !== void 0 && selectedAnnotations.some(function (selectedAnnotation) {
|
|
223
|
-
return selectedAnnotation.id === mark.attrs.id;
|
|
224
|
-
}));
|
|
225
|
-
var isUnresolved = !!annotations && annotations[mark.attrs.id] === false;
|
|
226
225
|
if (isVisible) {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
226
|
+
var isUnresolved = !!annotations && annotations[mark.attrs.id] === false;
|
|
227
|
+
if (isSupportedBlockNode) {
|
|
228
|
+
var isBlockNodeSelected = isCurrentBlockNodeSelected(state, node);
|
|
229
|
+
var attrs = isUnresolved ? {
|
|
230
|
+
class: isBlockNodeSelected ? "".concat(BlockAnnotationSharedClassNames.focus) : "".concat(BlockAnnotationSharedClassNames.blur)
|
|
231
|
+
} : {};
|
|
232
|
+
focusDecorations.push(Decoration.node(pos, pos + node.nodeSize, attrs, {
|
|
233
|
+
key: decorationKey.block
|
|
234
|
+
}));
|
|
235
|
+
} else {
|
|
236
|
+
var isSelected = !isInlineCommentViewClosed && !!(selectedAnnotations !== null && selectedAnnotations !== void 0 && selectedAnnotations.some(function (selectedAnnotation) {
|
|
237
|
+
return selectedAnnotation.id === mark.attrs.id;
|
|
238
|
+
}));
|
|
239
|
+
focusDecorations.push(Decoration.inline(pos, pos + node.nodeSize, {
|
|
240
|
+
class: "".concat(getAnnotationViewClassname(isUnresolved, isSelected), " ").concat(isUnresolved),
|
|
241
|
+
nodeName: 'span'
|
|
242
|
+
}));
|
|
243
|
+
}
|
|
231
244
|
}
|
|
232
245
|
});
|
|
233
246
|
});
|
package/dist/esm/utils.js
CHANGED
|
@@ -5,6 +5,7 @@ import { AnnotationSharedClassNames, BlockAnnotationSharedClassNames } from '@at
|
|
|
5
5
|
import { canApplyAnnotationOnRange, containsAnyAnnotations, getAnnotationIdsFromRange, hasAnnotationMark, isParagraph, isText } from '@atlaskit/editor-common/utils';
|
|
6
6
|
import { AllSelection, NodeSelection, PluginKey, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
7
7
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
8
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
8
9
|
import { AnnotationSelectionType } from './types';
|
|
9
10
|
export { hasAnnotationMark, containsAnyAnnotations };
|
|
10
11
|
function sum(arr, f) {
|
|
@@ -127,6 +128,18 @@ export var getAnnotationViewKey = function getAnnotationViewKey(annotations) {
|
|
|
127
128
|
}).join('_');
|
|
128
129
|
return "view-annotation-wrapper_".concat(keys);
|
|
129
130
|
};
|
|
131
|
+
export var isCurrentBlockNodeSelected = function isCurrentBlockNodeSelected(state, node) {
|
|
132
|
+
var selection = state.selection;
|
|
133
|
+
if (selection instanceof NodeSelection) {
|
|
134
|
+
if (selection.node === node) {
|
|
135
|
+
return true;
|
|
136
|
+
}
|
|
137
|
+
if (node.type.name === 'media' && selection.node.firstChild === node) {
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return false;
|
|
142
|
+
};
|
|
130
143
|
export var findAnnotationsInSelection = function findAnnotationsInSelection(selection, doc) {
|
|
131
144
|
var empty = selection.empty,
|
|
132
145
|
$anchor = selection.$anchor,
|
|
@@ -141,7 +154,7 @@ export var findAnnotationsInSelection = function findAnnotationsInSelection(sele
|
|
|
141
154
|
}
|
|
142
155
|
var annotationMark = doc.type.schema.marks.annotation;
|
|
143
156
|
var nodeBefore = $anchor.nodeBefore;
|
|
144
|
-
var anchorAnnotationMarks = node
|
|
157
|
+
var anchorAnnotationMarks = (node === null || node === void 0 ? void 0 : node.marks) || [];
|
|
145
158
|
var marks = [];
|
|
146
159
|
if (annotationMark.isInSet(anchorAnnotationMarks)) {
|
|
147
160
|
marks = anchorAnnotationMarks;
|
|
@@ -326,6 +339,9 @@ export function hasInvalidWhitespaceNode(selection, schema) {
|
|
|
326
339
|
var foundInvalidWhitespace = false;
|
|
327
340
|
var content = selection.content().content;
|
|
328
341
|
content.descendants(function (node) {
|
|
342
|
+
if (getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes') && node.type === schema.nodes.inlineCard) {
|
|
343
|
+
return false;
|
|
344
|
+
}
|
|
329
345
|
if (isText(node, schema)) {
|
|
330
346
|
return false;
|
|
331
347
|
}
|
package/dist/types/types.d.ts
CHANGED
|
@@ -94,8 +94,8 @@ export type InlineCommentState = {
|
|
|
94
94
|
resolved: boolean;
|
|
95
95
|
};
|
|
96
96
|
export type InlineCommentAnnotationProvider = AnnotationTypeProvider<AnnotationTypes.INLINE_COMMENT, InlineCommentState> & {
|
|
97
|
-
createComponent?: React.ComponentType<InlineCommentCreateComponentProps
|
|
98
|
-
viewComponent?: React.ComponentType<InlineCommentViewComponentProps
|
|
97
|
+
createComponent?: React.ComponentType<React.PropsWithChildren<InlineCommentCreateComponentProps>>;
|
|
98
|
+
viewComponent?: React.ComponentType<React.PropsWithChildren<InlineCommentViewComponentProps>>;
|
|
99
99
|
isToolbarAbove?: boolean;
|
|
100
100
|
/**
|
|
101
101
|
* @experimental Still under development. Do not use.
|
package/dist/types/utils.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export declare const decorationKey: {
|
|
|
20
20
|
};
|
|
21
21
|
export declare const addDraftDecoration: (start: number, end: number, targetType?: TargetType) => Decoration;
|
|
22
22
|
export declare const getAnnotationViewKey: (annotations: AnnotationInfo[]) => string;
|
|
23
|
+
export declare const isCurrentBlockNodeSelected: (state: EditorState, node: Node) => boolean;
|
|
23
24
|
export declare const findAnnotationsInSelection: (selection: Selection, doc: Node) => AnnotationInfo[];
|
|
24
25
|
export declare const resolveDraftBookmark: (editorState: EditorState, bookmark: SelectionBookmark, supportedBlockNodes?: string[]) => DraftBookmark;
|
|
25
26
|
/**
|
|
@@ -94,8 +94,8 @@ export type InlineCommentState = {
|
|
|
94
94
|
resolved: boolean;
|
|
95
95
|
};
|
|
96
96
|
export type InlineCommentAnnotationProvider = AnnotationTypeProvider<AnnotationTypes.INLINE_COMMENT, InlineCommentState> & {
|
|
97
|
-
createComponent?: React.ComponentType<InlineCommentCreateComponentProps
|
|
98
|
-
viewComponent?: React.ComponentType<InlineCommentViewComponentProps
|
|
97
|
+
createComponent?: React.ComponentType<React.PropsWithChildren<InlineCommentCreateComponentProps>>;
|
|
98
|
+
viewComponent?: React.ComponentType<React.PropsWithChildren<InlineCommentViewComponentProps>>;
|
|
99
99
|
isToolbarAbove?: boolean;
|
|
100
100
|
/**
|
|
101
101
|
* @experimental Still under development. Do not use.
|
|
@@ -20,6 +20,7 @@ export declare const decorationKey: {
|
|
|
20
20
|
};
|
|
21
21
|
export declare const addDraftDecoration: (start: number, end: number, targetType?: TargetType) => Decoration;
|
|
22
22
|
export declare const getAnnotationViewKey: (annotations: AnnotationInfo[]) => string;
|
|
23
|
+
export declare const isCurrentBlockNodeSelected: (state: EditorState, node: Node) => boolean;
|
|
23
24
|
export declare const findAnnotationsInSelection: (selection: Selection, doc: Node) => AnnotationInfo[];
|
|
24
25
|
export declare const resolveDraftBookmark: (editorState: EditorState, bookmark: SelectionBookmark, supportedBlockNodes?: string[]) => DraftBookmark;
|
|
25
26
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-annotation",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Annotation plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@atlaskit/adf-schema": "^35.6.0",
|
|
36
|
-
"@atlaskit/editor-common": "^78.
|
|
36
|
+
"@atlaskit/editor-common": "^78.14.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",
|
|
@@ -80,11 +80,9 @@
|
|
|
80
80
|
"ui-components": [
|
|
81
81
|
"lite-mode"
|
|
82
82
|
],
|
|
83
|
-
"deprecation":
|
|
84
|
-
"no-deprecated-imports"
|
|
85
|
-
],
|
|
83
|
+
"deprecation": "no-deprecated-imports",
|
|
86
84
|
"styling": [
|
|
87
|
-
"
|
|
85
|
+
"emotion",
|
|
88
86
|
"emotion"
|
|
89
87
|
],
|
|
90
88
|
"imports": [
|
|
@@ -96,6 +94,9 @@
|
|
|
96
94
|
"platform-feature-flags": {
|
|
97
95
|
"platform.editor.enable-selection-toolbar_ucdwd": {
|
|
98
96
|
"type": "boolean"
|
|
97
|
+
},
|
|
98
|
+
"platform.editor.allow-inline-comments-for-inline-nodes": {
|
|
99
|
+
"type": "boolean"
|
|
99
100
|
}
|
|
100
101
|
}
|
|
101
|
-
}
|
|
102
|
+
}
|