@atlaskit/editor-common 107.2.3 → 107.2.4
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 +9 -0
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/utils/annotation/index.js +35 -0
- package/dist/cjs/utils/index.js +6 -0
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/utils/annotation/index.js +35 -0
- package/dist/es2019/utils/index.js +1 -1
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/utils/annotation/index.js +34 -0
- package/dist/esm/utils/index.js +1 -1
- package/dist/types/utils/annotation/index.d.ts +8 -0
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/types-ts4.5/utils/annotation/index.d.ts +8 -0
- package/dist/types-ts4.5/utils/index.d.ts +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 107.2.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#176907](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/176907)
|
|
8
|
+
[`b3cdb5aa072a9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b3cdb5aa072a9) -
|
|
9
|
+
[ux] Adjust non-empty selection validation logic for the renderer, to disallow annotations on
|
|
10
|
+
empty block nodes like table cells and expands
|
|
11
|
+
|
|
3
12
|
## 107.2.3
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -16,7 +16,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
16
16
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
17
17
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
18
18
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
19
|
-
var packageVersion = "107.2.
|
|
19
|
+
var packageVersion = "107.2.3";
|
|
20
20
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
21
21
|
// Remove URL as it has UGC
|
|
22
22
|
// Ignored via go/ees007
|
|
@@ -23,7 +23,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
23
23
|
* @jsx jsx
|
|
24
24
|
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
25
25
|
var packageName = "@atlaskit/editor-common";
|
|
26
|
-
var packageVersion = "107.2.
|
|
26
|
+
var packageVersion = "107.2.3";
|
|
27
27
|
var halfFocusRing = 1;
|
|
28
28
|
var dropOffset = '0, 8';
|
|
29
29
|
// Ignored via go/ees005
|
|
@@ -12,6 +12,7 @@ exports.getAnnotationMarksForPos = getAnnotationMarksForPos;
|
|
|
12
12
|
exports.getRangeInlineNodeNames = getRangeInlineNodeNames;
|
|
13
13
|
exports.hasAnnotationMark = hasAnnotationMark;
|
|
14
14
|
exports.isEmptyTextSelection = isEmptyTextSelection;
|
|
15
|
+
exports.isEmptyTextSelectionRenderer = isEmptyTextSelectionRenderer;
|
|
15
16
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
16
17
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
17
18
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
@@ -191,4 +192,38 @@ function isEmptyTextSelection(selection, schema) {
|
|
|
191
192
|
return !hasContent;
|
|
192
193
|
});
|
|
193
194
|
return !hasContent;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* This is a modified version of the `isEmptyTextSelection` function (above), fixing some unexpected behavior in the renderer.
|
|
199
|
+
*
|
|
200
|
+
* This function does NOT consider non-inline nodes as non-empty.
|
|
201
|
+
* With this change, the function continues descending into block nodes, like tables or expands. Without this change for
|
|
202
|
+
* the renderer, block nodes containing empty text were not considered empty.
|
|
203
|
+
*/
|
|
204
|
+
function isEmptyTextSelectionRenderer(selection, schema) {
|
|
205
|
+
var _schema$nodes2 = schema.nodes,
|
|
206
|
+
text = _schema$nodes2.text,
|
|
207
|
+
paragraph = _schema$nodes2.paragraph;
|
|
208
|
+
var hasContent = false;
|
|
209
|
+
selection.content().content.descendants(function (node) {
|
|
210
|
+
// for empty paragraph - consider empty (nothing to comment on)
|
|
211
|
+
if (node.type === paragraph && !node.content.size) {
|
|
212
|
+
return false;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// for inline elements - consider nonempty
|
|
216
|
+
if (node.type !== text && node.type.isInline) {
|
|
217
|
+
hasContent = true;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// for nonempty text - consider nonempty (can comment if the node is supported for annotations)
|
|
221
|
+
if (node.type === text && !!node.textContent) {
|
|
222
|
+
hasContent = true;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// for other non-text nodes - continue descending
|
|
226
|
+
return !hasContent;
|
|
227
|
+
});
|
|
228
|
+
return !hasContent;
|
|
194
229
|
}
|
package/dist/cjs/utils/index.js
CHANGED
|
@@ -686,6 +686,12 @@ Object.defineProperty(exports, "isEmptyTextSelection", {
|
|
|
686
686
|
return _annotation.isEmptyTextSelection;
|
|
687
687
|
}
|
|
688
688
|
});
|
|
689
|
+
Object.defineProperty(exports, "isEmptyTextSelectionRenderer", {
|
|
690
|
+
enumerable: true,
|
|
691
|
+
get: function get() {
|
|
692
|
+
return _annotation.isEmptyTextSelectionRenderer;
|
|
693
|
+
}
|
|
694
|
+
});
|
|
689
695
|
Object.defineProperty(exports, "isFromCurrentDomain", {
|
|
690
696
|
enumerable: true,
|
|
691
697
|
get: function get() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isFedRamp } from './environment';
|
|
2
2
|
const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
3
3
|
const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
4
|
-
const packageVersion = "107.2.
|
|
4
|
+
const packageVersion = "107.2.3";
|
|
5
5
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
6
6
|
// Remove URL as it has UGC
|
|
7
7
|
// Ignored via go/ees007
|
|
@@ -13,7 +13,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
|
|
|
13
13
|
import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
14
14
|
import Layer from '../Layer';
|
|
15
15
|
const packageName = "@atlaskit/editor-common";
|
|
16
|
-
const packageVersion = "107.2.
|
|
16
|
+
const packageVersion = "107.2.3";
|
|
17
17
|
const halfFocusRing = 1;
|
|
18
18
|
const dropOffset = '0, 8';
|
|
19
19
|
// Ignored via go/ees005
|
|
@@ -186,4 +186,39 @@ export function isEmptyTextSelection(selection, schema) {
|
|
|
186
186
|
return !hasContent;
|
|
187
187
|
});
|
|
188
188
|
return !hasContent;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* This is a modified version of the `isEmptyTextSelection` function (above), fixing some unexpected behavior in the renderer.
|
|
193
|
+
*
|
|
194
|
+
* This function does NOT consider non-inline nodes as non-empty.
|
|
195
|
+
* With this change, the function continues descending into block nodes, like tables or expands. Without this change for
|
|
196
|
+
* the renderer, block nodes containing empty text were not considered empty.
|
|
197
|
+
*/
|
|
198
|
+
export function isEmptyTextSelectionRenderer(selection, schema) {
|
|
199
|
+
const {
|
|
200
|
+
text,
|
|
201
|
+
paragraph
|
|
202
|
+
} = schema.nodes;
|
|
203
|
+
let hasContent = false;
|
|
204
|
+
selection.content().content.descendants(node => {
|
|
205
|
+
// for empty paragraph - consider empty (nothing to comment on)
|
|
206
|
+
if (node.type === paragraph && !node.content.size) {
|
|
207
|
+
return false;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// for inline elements - consider nonempty
|
|
211
|
+
if (node.type !== text && node.type.isInline) {
|
|
212
|
+
hasContent = true;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// for nonempty text - consider nonempty (can comment if the node is supported for annotations)
|
|
216
|
+
if (node.type === text && !!node.textContent) {
|
|
217
|
+
hasContent = true;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// for other non-text nodes - continue descending
|
|
221
|
+
return !hasContent;
|
|
222
|
+
});
|
|
223
|
+
return !hasContent;
|
|
189
224
|
}
|
|
@@ -5,7 +5,7 @@ import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
|
5
5
|
import { hasDocAsParent } from './document';
|
|
6
6
|
import { isEmptyParagraph } from './editor-core-utils';
|
|
7
7
|
export { shouldAutoLinkifyMatch } from './should-auto-linkify-tld';
|
|
8
|
-
export { getAnnotationMarksForPos, canApplyAnnotationOnRange, containsAnyAnnotations, getAnnotationIdsFromRange, getAnnotationInlineNodeTypes, hasAnnotationMark, getRangeInlineNodeNames, isEmptyTextSelection } from './annotation';
|
|
8
|
+
export { getAnnotationMarksForPos, canApplyAnnotationOnRange, containsAnyAnnotations, getAnnotationIdsFromRange, getAnnotationInlineNodeTypes, hasAnnotationMark, getRangeInlineNodeNames, isEmptyTextSelection, isEmptyTextSelectionRenderer } from './annotation';
|
|
9
9
|
export { getExtensionLozengeData } from './macro';
|
|
10
10
|
export {
|
|
11
11
|
/**
|
|
@@ -7,7 +7,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
7
7
|
import { isFedRamp } from './environment';
|
|
8
8
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
9
9
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
10
|
-
var packageVersion = "107.2.
|
|
10
|
+
var packageVersion = "107.2.3";
|
|
11
11
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
12
12
|
// Remove URL as it has UGC
|
|
13
13
|
// Ignored via go/ees007
|
|
@@ -20,7 +20,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
|
|
|
20
20
|
import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
21
21
|
import Layer from '../Layer';
|
|
22
22
|
var packageName = "@atlaskit/editor-common";
|
|
23
|
-
var packageVersion = "107.2.
|
|
23
|
+
var packageVersion = "107.2.3";
|
|
24
24
|
var halfFocusRing = 1;
|
|
25
25
|
var dropOffset = '0, 8';
|
|
26
26
|
// Ignored via go/ees005
|
|
@@ -177,4 +177,38 @@ export function isEmptyTextSelection(selection, schema) {
|
|
|
177
177
|
return !hasContent;
|
|
178
178
|
});
|
|
179
179
|
return !hasContent;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* This is a modified version of the `isEmptyTextSelection` function (above), fixing some unexpected behavior in the renderer.
|
|
184
|
+
*
|
|
185
|
+
* This function does NOT consider non-inline nodes as non-empty.
|
|
186
|
+
* With this change, the function continues descending into block nodes, like tables or expands. Without this change for
|
|
187
|
+
* the renderer, block nodes containing empty text were not considered empty.
|
|
188
|
+
*/
|
|
189
|
+
export function isEmptyTextSelectionRenderer(selection, schema) {
|
|
190
|
+
var _schema$nodes2 = schema.nodes,
|
|
191
|
+
text = _schema$nodes2.text,
|
|
192
|
+
paragraph = _schema$nodes2.paragraph;
|
|
193
|
+
var hasContent = false;
|
|
194
|
+
selection.content().content.descendants(function (node) {
|
|
195
|
+
// for empty paragraph - consider empty (nothing to comment on)
|
|
196
|
+
if (node.type === paragraph && !node.content.size) {
|
|
197
|
+
return false;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// for inline elements - consider nonempty
|
|
201
|
+
if (node.type !== text && node.type.isInline) {
|
|
202
|
+
hasContent = true;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// for nonempty text - consider nonempty (can comment if the node is supported for annotations)
|
|
206
|
+
if (node.type === text && !!node.textContent) {
|
|
207
|
+
hasContent = true;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// for other non-text nodes - continue descending
|
|
211
|
+
return !hasContent;
|
|
212
|
+
});
|
|
213
|
+
return !hasContent;
|
|
180
214
|
}
|
package/dist/esm/utils/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
|
5
5
|
import { hasDocAsParent } from './document';
|
|
6
6
|
import { isEmptyParagraph } from './editor-core-utils';
|
|
7
7
|
export { shouldAutoLinkifyMatch } from './should-auto-linkify-tld';
|
|
8
|
-
export { getAnnotationMarksForPos, canApplyAnnotationOnRange, containsAnyAnnotations, getAnnotationIdsFromRange, getAnnotationInlineNodeTypes, hasAnnotationMark, getRangeInlineNodeNames, isEmptyTextSelection } from './annotation';
|
|
8
|
+
export { getAnnotationMarksForPos, canApplyAnnotationOnRange, containsAnyAnnotations, getAnnotationIdsFromRange, getAnnotationInlineNodeTypes, hasAnnotationMark, getRangeInlineNodeNames, isEmptyTextSelection, isEmptyTextSelectionRenderer } from './annotation';
|
|
9
9
|
export { getExtensionLozengeData } from './macro';
|
|
10
10
|
export {
|
|
11
11
|
/**
|
|
@@ -36,4 +36,12 @@ export declare function getAnnotationMarksForPos(pos: ResolvedPos): Mark[] | und
|
|
|
36
36
|
* e.g. when you select across multiple empty paragraphs
|
|
37
37
|
*/
|
|
38
38
|
export declare function isEmptyTextSelection(selection: TextSelection | AllSelection, schema: Schema): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* This is a modified version of the `isEmptyTextSelection` function (above), fixing some unexpected behavior in the renderer.
|
|
41
|
+
*
|
|
42
|
+
* This function does NOT consider non-inline nodes as non-empty.
|
|
43
|
+
* With this change, the function continues descending into block nodes, like tables or expands. Without this change for
|
|
44
|
+
* the renderer, block nodes containing empty text were not considered empty.
|
|
45
|
+
*/
|
|
46
|
+
export declare function isEmptyTextSelectionRenderer(selection: TextSelection | AllSelection, schema: Schema): boolean;
|
|
39
47
|
export {};
|
|
@@ -2,7 +2,7 @@ import type { Node as PMNode, ResolvedPos, Schema } from '@atlaskit/editor-prose
|
|
|
2
2
|
import type { EditorState, Selection } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import type { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
4
4
|
export { shouldAutoLinkifyMatch } from './should-auto-linkify-tld';
|
|
5
|
-
export { getAnnotationMarksForPos, canApplyAnnotationOnRange, containsAnyAnnotations, getAnnotationIdsFromRange, getAnnotationInlineNodeTypes, hasAnnotationMark, getRangeInlineNodeNames, isEmptyTextSelection, } from './annotation';
|
|
5
|
+
export { getAnnotationMarksForPos, canApplyAnnotationOnRange, containsAnyAnnotations, getAnnotationIdsFromRange, getAnnotationInlineNodeTypes, hasAnnotationMark, getRangeInlineNodeNames, isEmptyTextSelection, isEmptyTextSelectionRenderer, } from './annotation';
|
|
6
6
|
export { getExtensionLozengeData } from './macro';
|
|
7
7
|
export type { Params } from './macro';
|
|
8
8
|
export {
|
|
@@ -36,4 +36,12 @@ export declare function getAnnotationMarksForPos(pos: ResolvedPos): Mark[] | und
|
|
|
36
36
|
* e.g. when you select across multiple empty paragraphs
|
|
37
37
|
*/
|
|
38
38
|
export declare function isEmptyTextSelection(selection: TextSelection | AllSelection, schema: Schema): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* This is a modified version of the `isEmptyTextSelection` function (above), fixing some unexpected behavior in the renderer.
|
|
41
|
+
*
|
|
42
|
+
* This function does NOT consider non-inline nodes as non-empty.
|
|
43
|
+
* With this change, the function continues descending into block nodes, like tables or expands. Without this change for
|
|
44
|
+
* the renderer, block nodes containing empty text were not considered empty.
|
|
45
|
+
*/
|
|
46
|
+
export declare function isEmptyTextSelectionRenderer(selection: TextSelection | AllSelection, schema: Schema): boolean;
|
|
39
47
|
export {};
|
|
@@ -2,7 +2,7 @@ import type { Node as PMNode, ResolvedPos, Schema } from '@atlaskit/editor-prose
|
|
|
2
2
|
import type { EditorState, Selection } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import type { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
4
4
|
export { shouldAutoLinkifyMatch } from './should-auto-linkify-tld';
|
|
5
|
-
export { getAnnotationMarksForPos, canApplyAnnotationOnRange, containsAnyAnnotations, getAnnotationIdsFromRange, getAnnotationInlineNodeTypes, hasAnnotationMark, getRangeInlineNodeNames, isEmptyTextSelection, } from './annotation';
|
|
5
|
+
export { getAnnotationMarksForPos, canApplyAnnotationOnRange, containsAnyAnnotations, getAnnotationIdsFromRange, getAnnotationInlineNodeTypes, hasAnnotationMark, getRangeInlineNodeNames, isEmptyTextSelection, isEmptyTextSelectionRenderer, } from './annotation';
|
|
6
6
|
export { getExtensionLozengeData } from './macro';
|
|
7
7
|
export type { Params } from './macro';
|
|
8
8
|
export {
|
package/package.json
CHANGED