@atlaskit/editor-common 94.8.1 → 94.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 94.9.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 94.9.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`9b887cc6b70f9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9b887cc6b70f9) -
14
+ [ux] EDF-1733: Add Define button to selection toolbar in live pages view mode
15
+ - [#152319](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/152319)
16
+ [`bfa9c49e1928b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/bfa9c49e1928b) -
17
+ [ux] Added a check to handle the case where a single non-breaking space is selected and the user
18
+ attempts to leave a comment on it.
19
+
3
20
  ## 94.8.1
4
21
 
5
22
  ### Patch Changes
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.aiDefinitionsMessages = void 0;
7
+ var _reactIntlNext = require("react-intl-next");
8
+ var aiDefinitionsMessages = exports.aiDefinitionsMessages = (0, _reactIntlNext.defineMessages)({
9
+ aiDefineToolbarButtonTitle: {
10
+ id: 'fabric.editor.ai.selectionToolbar.define.title',
11
+ defaultMessage: 'Define',
12
+ description: 'Title for AI Define button in editor selection floating toolbar in live pages view mode'
13
+ },
14
+ aiDefineToolbarButtonDisabledTooltip: {
15
+ id: 'fabric.editor.ai.selectionToolbar.define.disabled.tooltip',
16
+ defaultMessage: 'Highlight a term, acronym, or abbreviation',
17
+ description: 'Tooltip for explaining why AI define button in editor selection floating toolbar is disabled (due to exceeding max word count) in live pages view mode'
18
+ }
19
+ });
@@ -3,6 +3,12 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ Object.defineProperty(exports, "aiDefinitionsMessages", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _aiDefinitions.aiDefinitionsMessages;
10
+ }
11
+ });
6
12
  Object.defineProperty(exports, "alignmentMessages", {
7
13
  enumerable: true,
8
14
  get: function get() {
@@ -197,6 +203,7 @@ Object.defineProperty(exports, "unsupportedContentMessages", {
197
203
  }
198
204
  });
199
205
  var _reactIntlNext = require("react-intl-next");
206
+ var _aiDefinitions = require("./ai-definitions");
200
207
  var _alignment = require("./alignment");
201
208
  var _annotation = require("./annotation");
202
209
  var _blockType = require("./block-type");
@@ -17,7 +17,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
17
17
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
18
18
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
19
19
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
20
- var packageVersion = "94.8.1";
20
+ var packageVersion = "94.9.1";
21
21
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
22
22
  // Remove URL as it has UGC
23
23
  // TODO: Sanitise the URL instead of just removing it
@@ -24,7 +24,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
24
24
  * @jsx jsx
25
25
  */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
26
26
  var packageName = "@atlaskit/editor-common";
27
- var packageVersion = "94.8.1";
27
+ var packageVersion = "94.9.1";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var DropList = /*#__PURE__*/function (_Component) {
@@ -11,6 +11,7 @@ exports.getAnnotationInlineNodeTypes = getAnnotationInlineNodeTypes;
11
11
  exports.getAnnotationMarksForPos = getAnnotationMarksForPos;
12
12
  exports.getRangeInlineNodeNames = getRangeInlineNodeNames;
13
13
  exports.hasAnnotationMark = hasAnnotationMark;
14
+ exports.isEmptyTextSelection = isEmptyTextSelection;
14
15
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
15
16
  var _adfSchema = require("@atlaskit/adf-schema");
16
17
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
@@ -167,4 +168,27 @@ function getAnnotationMarksForPos(pos) {
167
168
  return mark.type === pos.doc.type.schema.marks.annotation;
168
169
  });
169
170
  return annotationMarks;
171
+ }
172
+
173
+ /**
174
+ * Checks if selection contains only empty text
175
+ * e.g. when you select across multiple empty paragraphs
176
+ */
177
+ function isEmptyTextSelection(selection, schema) {
178
+ var _schema$nodes = schema.nodes,
179
+ text = _schema$nodes.text,
180
+ paragraph = _schema$nodes.paragraph;
181
+ var hasContent = false;
182
+ selection.content().content.descendants(function (node) {
183
+ // for empty paragraph - consider empty (nothing to comment on)
184
+ if (node.type === paragraph && !node.content.size) {
185
+ return false;
186
+ }
187
+ // for not a text or nonempty text - consider nonempty (can comment if the node is supported for annotations)
188
+ if (node.type !== text || !node.textContent) {
189
+ hasContent = true;
190
+ }
191
+ return !hasContent;
192
+ });
193
+ return !hasContent;
170
194
  }
@@ -656,6 +656,12 @@ Object.defineProperty(exports, "isEmptySelectionAtStart", {
656
656
  return _commands.isEmptySelectionAtStart;
657
657
  }
658
658
  });
659
+ Object.defineProperty(exports, "isEmptyTextSelection", {
660
+ enumerable: true,
661
+ get: function get() {
662
+ return _annotation.isEmptyTextSelection;
663
+ }
664
+ });
659
665
  Object.defineProperty(exports, "isFromCurrentDomain", {
660
666
  enumerable: true,
661
667
  get: function get() {
@@ -0,0 +1,13 @@
1
+ import { defineMessages } from 'react-intl-next';
2
+ export const aiDefinitionsMessages = defineMessages({
3
+ aiDefineToolbarButtonTitle: {
4
+ id: 'fabric.editor.ai.selectionToolbar.define.title',
5
+ defaultMessage: 'Define',
6
+ description: 'Title for AI Define button in editor selection floating toolbar in live pages view mode'
7
+ },
8
+ aiDefineToolbarButtonDisabledTooltip: {
9
+ id: 'fabric.editor.ai.selectionToolbar.define.disabled.tooltip',
10
+ defaultMessage: 'Highlight a term, acronym, or abbreviation',
11
+ description: 'Tooltip for explaining why AI define button in editor selection floating toolbar is disabled (due to exceeding max word count) in live pages view mode'
12
+ }
13
+ });
@@ -1,4 +1,5 @@
1
1
  import { defineMessages } from 'react-intl-next';
2
+ export { aiDefinitionsMessages } from './ai-definitions';
2
3
  export { alignmentMessages } from './alignment';
3
4
  export { annotationMessages } from './annotation';
4
5
  export { messages as blockTypeMessages } from './block-type';
@@ -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 = "94.8.1";
4
+ const packageVersion = "94.9.1";
5
5
  const sanitiseSentryEvents = (data, _hint) => {
6
6
  // Remove URL as it has UGC
7
7
  // TODO: Sanitise the URL instead of just removing it
@@ -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 = "94.8.1";
16
+ const packageVersion = "94.9.1";
17
17
  const halfFocusRing = 1;
18
18
  const dropOffset = '0, 8';
19
19
  class DropList extends Component {
@@ -162,4 +162,28 @@ export function getAnnotationMarksForPos(pos) {
162
162
  }
163
163
  const annotationMarks = pos.marks().filter(mark => mark.type === pos.doc.type.schema.marks.annotation);
164
164
  return annotationMarks;
165
+ }
166
+
167
+ /**
168
+ * Checks if selection contains only empty text
169
+ * e.g. when you select across multiple empty paragraphs
170
+ */
171
+ export function isEmptyTextSelection(selection, schema) {
172
+ const {
173
+ text,
174
+ paragraph
175
+ } = schema.nodes;
176
+ let hasContent = false;
177
+ selection.content().content.descendants(node => {
178
+ // for empty paragraph - consider empty (nothing to comment on)
179
+ if (node.type === paragraph && !node.content.size) {
180
+ return false;
181
+ }
182
+ // for not a text or nonempty text - consider nonempty (can comment if the node is supported for annotations)
183
+ if (node.type !== text || !node.textContent) {
184
+ hasContent = true;
185
+ }
186
+ return !hasContent;
187
+ });
188
+ return !hasContent;
165
189
  }
@@ -2,7 +2,7 @@ import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
2
2
  import { hasDocAsParent } from './document';
3
3
  import { isEmptyParagraph } from './editor-core-utils';
4
4
  export { shouldAutoLinkifyMatch } from './should-auto-linkify-tld';
5
- export { getAnnotationMarksForPos, canApplyAnnotationOnRange, containsAnyAnnotations, getAnnotationIdsFromRange, getAnnotationInlineNodeTypes, hasAnnotationMark, getRangeInlineNodeNames } from './annotation';
5
+ export { getAnnotationMarksForPos, canApplyAnnotationOnRange, containsAnyAnnotations, getAnnotationIdsFromRange, getAnnotationInlineNodeTypes, hasAnnotationMark, getRangeInlineNodeNames, isEmptyTextSelection } from './annotation';
6
6
  export { getExtensionLozengeData } from './macro';
7
7
  export {
8
8
  /**
@@ -0,0 +1,13 @@
1
+ import { defineMessages } from 'react-intl-next';
2
+ export var aiDefinitionsMessages = defineMessages({
3
+ aiDefineToolbarButtonTitle: {
4
+ id: 'fabric.editor.ai.selectionToolbar.define.title',
5
+ defaultMessage: 'Define',
6
+ description: 'Title for AI Define button in editor selection floating toolbar in live pages view mode'
7
+ },
8
+ aiDefineToolbarButtonDisabledTooltip: {
9
+ id: 'fabric.editor.ai.selectionToolbar.define.disabled.tooltip',
10
+ defaultMessage: 'Highlight a term, acronym, or abbreviation',
11
+ description: 'Tooltip for explaining why AI define button in editor selection floating toolbar is disabled (due to exceeding max word count) in live pages view mode'
12
+ }
13
+ });
@@ -1,4 +1,5 @@
1
1
  import { defineMessages } from 'react-intl-next';
2
+ export { aiDefinitionsMessages } from './ai-definitions';
2
3
  export { alignmentMessages } from './alignment';
3
4
  export { annotationMessages } from './annotation';
4
5
  export { messages as blockTypeMessages } from './block-type';
@@ -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 = "94.8.1";
10
+ var packageVersion = "94.9.1";
11
11
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
12
12
  // Remove URL as it has UGC
13
13
  // TODO: Sanitise the URL instead of just removing it
@@ -21,7 +21,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
21
21
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
22
22
  import Layer from '../Layer';
23
23
  var packageName = "@atlaskit/editor-common";
24
- var packageVersion = "94.8.1";
24
+ var packageVersion = "94.9.1";
25
25
  var halfFocusRing = 1;
26
26
  var dropOffset = '0, 8';
27
27
  var DropList = /*#__PURE__*/function (_Component) {
@@ -154,4 +154,27 @@ export function getAnnotationMarksForPos(pos) {
154
154
  return mark.type === pos.doc.type.schema.marks.annotation;
155
155
  });
156
156
  return annotationMarks;
157
+ }
158
+
159
+ /**
160
+ * Checks if selection contains only empty text
161
+ * e.g. when you select across multiple empty paragraphs
162
+ */
163
+ export function isEmptyTextSelection(selection, schema) {
164
+ var _schema$nodes = schema.nodes,
165
+ text = _schema$nodes.text,
166
+ paragraph = _schema$nodes.paragraph;
167
+ var hasContent = false;
168
+ selection.content().content.descendants(function (node) {
169
+ // for empty paragraph - consider empty (nothing to comment on)
170
+ if (node.type === paragraph && !node.content.size) {
171
+ return false;
172
+ }
173
+ // for not a text or nonempty text - consider nonempty (can comment if the node is supported for annotations)
174
+ if (node.type !== text || !node.textContent) {
175
+ hasContent = true;
176
+ }
177
+ return !hasContent;
178
+ });
179
+ return !hasContent;
157
180
  }
@@ -2,7 +2,7 @@ import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
2
2
  import { hasDocAsParent } from './document';
3
3
  import { isEmptyParagraph } from './editor-core-utils';
4
4
  export { shouldAutoLinkifyMatch } from './should-auto-linkify-tld';
5
- export { getAnnotationMarksForPos, canApplyAnnotationOnRange, containsAnyAnnotations, getAnnotationIdsFromRange, getAnnotationInlineNodeTypes, hasAnnotationMark, getRangeInlineNodeNames } from './annotation';
5
+ export { getAnnotationMarksForPos, canApplyAnnotationOnRange, containsAnyAnnotations, getAnnotationIdsFromRange, getAnnotationInlineNodeTypes, hasAnnotationMark, getRangeInlineNodeNames, isEmptyTextSelection } from './annotation';
6
6
  export { getExtensionLozengeData } from './macro';
7
7
  export {
8
8
  /**
@@ -0,0 +1,12 @@
1
+ export declare const aiDefinitionsMessages: {
2
+ aiDefineToolbarButtonTitle: {
3
+ id: string;
4
+ defaultMessage: string;
5
+ description: string;
6
+ };
7
+ aiDefineToolbarButtonDisabledTooltip: {
8
+ id: string;
9
+ defaultMessage: string;
10
+ description: string;
11
+ };
12
+ };
@@ -1,3 +1,4 @@
1
+ export { aiDefinitionsMessages } from './ai-definitions';
1
2
  export { alignmentMessages } from './alignment';
2
3
  export { annotationMessages } from './annotation';
3
4
  export { messages as blockTypeMessages } from './block-type';
@@ -1,5 +1,5 @@
1
1
  import type { Mark, Node as PMNode, ResolvedPos, Schema, Slice } from '@atlaskit/editor-prosemirror/model';
2
- import type { EditorState } from '@atlaskit/editor-prosemirror/state';
2
+ import type { AllSelection, EditorState, TextSelection } from '@atlaskit/editor-prosemirror/state';
3
3
  type Range = {
4
4
  from: number;
5
5
  to: number;
@@ -31,4 +31,9 @@ export declare function getAnnotationInlineNodeTypes(state: {
31
31
  schema: Schema;
32
32
  }, annotationId: string): string[] | undefined;
33
33
  export declare function getAnnotationMarksForPos(pos: ResolvedPos): Mark[] | undefined;
34
+ /**
35
+ * Checks if selection contains only empty text
36
+ * e.g. when you select across multiple empty paragraphs
37
+ */
38
+ export declare function isEmptyTextSelection(selection: TextSelection | AllSelection, schema: Schema): boolean;
34
39
  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, } from './annotation';
5
+ export { getAnnotationMarksForPos, canApplyAnnotationOnRange, containsAnyAnnotations, getAnnotationIdsFromRange, getAnnotationInlineNodeTypes, hasAnnotationMark, getRangeInlineNodeNames, isEmptyTextSelection, } from './annotation';
6
6
  export { getExtensionLozengeData } from './macro';
7
7
  export type { Params } from './macro';
8
8
  export {
@@ -0,0 +1,12 @@
1
+ export declare const aiDefinitionsMessages: {
2
+ aiDefineToolbarButtonTitle: {
3
+ id: string;
4
+ defaultMessage: string;
5
+ description: string;
6
+ };
7
+ aiDefineToolbarButtonDisabledTooltip: {
8
+ id: string;
9
+ defaultMessage: string;
10
+ description: string;
11
+ };
12
+ };
@@ -1,3 +1,4 @@
1
+ export { aiDefinitionsMessages } from './ai-definitions';
1
2
  export { alignmentMessages } from './alignment';
2
3
  export { annotationMessages } from './annotation';
3
4
  export { messages as blockTypeMessages } from './block-type';
@@ -1,5 +1,5 @@
1
1
  import type { Mark, Node as PMNode, ResolvedPos, Schema, Slice } from '@atlaskit/editor-prosemirror/model';
2
- import type { EditorState } from '@atlaskit/editor-prosemirror/state';
2
+ import type { AllSelection, EditorState, TextSelection } from '@atlaskit/editor-prosemirror/state';
3
3
  type Range = {
4
4
  from: number;
5
5
  to: number;
@@ -31,4 +31,9 @@ export declare function getAnnotationInlineNodeTypes(state: {
31
31
  schema: Schema;
32
32
  }, annotationId: string): string[] | undefined;
33
33
  export declare function getAnnotationMarksForPos(pos: ResolvedPos): Mark[] | undefined;
34
+ /**
35
+ * Checks if selection contains only empty text
36
+ * e.g. when you select across multiple empty paragraphs
37
+ */
38
+ export declare function isEmptyTextSelection(selection: TextSelection | AllSelection, schema: Schema): boolean;
34
39
  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, } from './annotation';
5
+ export { getAnnotationMarksForPos, canApplyAnnotationOnRange, containsAnyAnnotations, getAnnotationIdsFromRange, getAnnotationInlineNodeTypes, hasAnnotationMark, getRangeInlineNodeNames, isEmptyTextSelection, } 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": "94.8.1",
3
+ "version": "94.9.1",
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/"
@@ -130,7 +130,7 @@
130
130
  "@atlaskit/icon-object": "^6.7.0",
131
131
  "@atlaskit/link-datasource": "^3.6.0",
132
132
  "@atlaskit/link-picker": "^1.47.0",
133
- "@atlaskit/media-card": "^78.9.0",
133
+ "@atlaskit/media-card": "^78.10.0",
134
134
  "@atlaskit/media-client": "^28.0.0",
135
135
  "@atlaskit/media-client-react": "^2.2.0",
136
136
  "@atlaskit/media-common": "^11.7.0",
@@ -140,7 +140,7 @@
140
140
  "@atlaskit/media-viewer": "49.2.4",
141
141
  "@atlaskit/mention": "^23.3.0",
142
142
  "@atlaskit/menu": "^2.13.0",
143
- "@atlaskit/onboarding": "^11.16.0",
143
+ "@atlaskit/onboarding": "^12.0.0",
144
144
  "@atlaskit/platform-feature-flags": "^0.3.0",
145
145
  "@atlaskit/popper": "^6.3.0",
146
146
  "@atlaskit/primitives": "^13.0.0",