@atlaskit/editor-common 107.2.3 → 107.2.5

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 CHANGED
@@ -1,5 +1,23 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 107.2.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [#177767](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/177767)
8
+ [`7096b2462638f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7096b2462638f) -
9
+ fix expvalequals check for platform_editor_breakout_resizing
10
+ - Updated dependencies
11
+
12
+ ## 107.2.4
13
+
14
+ ### Patch Changes
15
+
16
+ - [#176907](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/176907)
17
+ [`b3cdb5aa072a9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b3cdb5aa072a9) -
18
+ [ux] Adjust non-empty selection validation logic for the renderer, to disallow annotations on
19
+ empty block nodes like table cells and expands
20
+
3
21
  ## 107.2.3
4
22
 
5
23
  ### 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.2";
19
+ var packageVersion = "107.2.4";
20
20
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
21
21
  // Remove URL as it has UGC
22
22
  // Ignored via go/ees007
@@ -79,7 +79,7 @@ var pragmaticStylesLayoutFirstNodeResizeHandleFix = exports.pragmaticStylesLayou
79
79
 
80
80
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles
81
81
  var pragmaticResizerStyles = exports.pragmaticResizerStyles = function pragmaticResizerStyles() {
82
- if ((0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_breakout_resizing', 'isEnabled', false)) {
82
+ if (!(0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_breakout_resizing', 'isEnabled', true)) {
83
83
  return;
84
84
  }
85
85
 
@@ -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.2";
26
+ var packageVersion = "107.2.4";
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
  }
@@ -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.2";
4
+ const packageVersion = "107.2.4";
5
5
  const sanitiseSentryEvents = (data, _hint) => {
6
6
  // Remove URL as it has UGC
7
7
  // Ignored via go/ees007
@@ -266,7 +266,7 @@ export const pragmaticStylesLayoutFirstNodeResizeHandleFix = () => {
266
266
 
267
267
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles
268
268
  export const pragmaticResizerStyles = () => {
269
- if (expValEqualsNoExposure('platform_editor_breakout_resizing', 'isEnabled', false)) {
269
+ if (!expValEqualsNoExposure('platform_editor_breakout_resizing', 'isEnabled', true)) {
270
270
  return;
271
271
  }
272
272
 
@@ -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.2";
16
+ const packageVersion = "107.2.4";
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.2";
10
+ var packageVersion = "107.2.4";
11
11
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
12
12
  // Remove URL as it has UGC
13
13
  // Ignored via go/ees007
@@ -73,7 +73,7 @@ export var pragmaticStylesLayoutFirstNodeResizeHandleFix = function pragmaticSty
73
73
 
74
74
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles
75
75
  export var pragmaticResizerStyles = function pragmaticResizerStyles() {
76
- if (expValEqualsNoExposure('platform_editor_breakout_resizing', 'isEnabled', false)) {
76
+ if (!expValEqualsNoExposure('platform_editor_breakout_resizing', 'isEnabled', true)) {
77
77
  return;
78
78
  }
79
79
 
@@ -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.2";
23
+ var packageVersion = "107.2.4";
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
  }
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "107.2.3",
3
+ "version": "107.2.5",
4
4
  "description": "A package that contains common classes and components for editor and renderer",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -147,13 +147,13 @@
147
147
  "@atlaskit/link-datasource": "^4.11.0",
148
148
  "@atlaskit/link-picker": "^3.5.0",
149
149
  "@atlaskit/media-card": "^79.3.0",
150
- "@atlaskit/media-client": "^34.1.0",
150
+ "@atlaskit/media-client": "^34.2.0",
151
151
  "@atlaskit/media-client-react": "^4.1.0",
152
- "@atlaskit/media-common": "^12.2.0",
152
+ "@atlaskit/media-common": "^12.3.0",
153
153
  "@atlaskit/media-file-preview": "^0.11.0",
154
154
  "@atlaskit/media-picker": "^70.0.0",
155
155
  "@atlaskit/media-ui": "^28.5.0",
156
- "@atlaskit/media-viewer": "^52.3.0",
156
+ "@atlaskit/media-viewer": "^52.4.0",
157
157
  "@atlaskit/mention": "^24.2.0",
158
158
  "@atlaskit/menu": "^8.0.0",
159
159
  "@atlaskit/onboarding": "^14.2.0",