@atlaskit/editor-common 112.2.3 → 112.3.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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 112.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`71fb8b5aa2558`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/71fb8b5aa2558) -
8
+ [FFCLEANUP-79003] clean up feature flag platform_editor_blocktaskitem_patch_2
9
+
10
+ ### Patch Changes
11
+
12
+ - [`e8c15530a001b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e8c15530a001b) -
13
+ NO-ISSUE Updated menu labelling for on-paste actions menu
14
+
3
15
  ## 112.2.3
4
16
 
5
17
  ### Patch Changes
@@ -43,7 +43,7 @@ var pasteOptionsToolbarMessages = exports.pasteOptionsToolbarMessages = (0, _rea
43
43
  },
44
44
  pasteMenuActionsTitle: {
45
45
  id: 'fabric.editor.pasteMenuActionsTitle',
46
- defaultMessage: 'Actions',
46
+ defaultMessage: 'Paste actions',
47
47
  description: 'Section title for actions in the paste options menu'
48
48
  }
49
49
  });
@@ -19,7 +19,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
19
19
  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); }
20
20
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
21
21
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
22
- var packageVersion = "0.0.0-development";
22
+ var packageVersion = "112.2.3";
23
23
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
24
24
  // Remove URL as it has UGC
25
25
  // Ignored via go/ees007
@@ -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 = "0.0.0-development";
27
+ var packageVersion = "112.2.3";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var fadeIn = (0, _react2.keyframes)({
@@ -285,7 +285,7 @@ var isEmptySelectionAtStart = exports.isEmptySelectionAtStart = function isEmpty
285
285
 
286
286
  // If blockTaskItem is in the schema,
287
287
  // we need to check if the selection is inside a blockTaskItem
288
- if (blockTaskItem && empty && (0, _platformFeatureFlags.fg)('platform_editor_blocktaskitem_patch_2')) {
288
+ if (blockTaskItem && empty) {
289
289
  // If the parent is in a textblock,
290
290
  // check if it's nested inside a blockTaskItem
291
291
  if ($from.parent.isTextblock) {
@@ -309,17 +309,8 @@ var isEmptySelectionAtStart = exports.isEmptySelectionAtStart = function isEmpty
309
309
  // Else, check if the parent is a blockTaskItem
310
310
  else if ($from.parent.type === blockTaskItem) {
311
311
  // Check if the selection is at the start of the blockTaskItem
312
- var firstPosInBlockTaskItem = 0;
313
- if ((0, _platformFeatureFlags.fg)('platform_editor_blocktaskitem_patch_2')) {
314
- var blockTaskItemDepth = $from.depth;
315
-
316
- // When cleaning up platform_editor_blocktaskitem_patch_2, set firstPosInBlockTaskItem as const
317
- firstPosInBlockTaskItem = $from.start(blockTaskItemDepth);
318
- } else {
319
- var _blockTaskItemDepth = $from.depth - 1;
320
- var DISTANCE_FROM_PARENT_FOR_GAP_CURSOR = 1;
321
- firstPosInBlockTaskItem = $from.start(_blockTaskItemDepth) + DISTANCE_FROM_PARENT_FOR_GAP_CURSOR;
322
- }
312
+ var blockTaskItemDepth = $from.depth;
313
+ var firstPosInBlockTaskItem = $from.start(blockTaskItemDepth);
323
314
 
324
315
  // Is the selection at the first possible position inside the blockTaskItem
325
316
  return $from.pos === firstPosInBlockTaskItem;
@@ -37,7 +37,7 @@ export const pasteOptionsToolbarMessages = defineMessages({
37
37
  },
38
38
  pasteMenuActionsTitle: {
39
39
  id: 'fabric.editor.pasteMenuActionsTitle',
40
- defaultMessage: 'Actions',
40
+ defaultMessage: 'Paste actions',
41
41
  description: 'Section title for actions in the paste options menu'
42
42
  }
43
43
  });
@@ -4,7 +4,7 @@ import { isFedRamp } from './environment';
4
4
  import { normaliseSentryBreadcrumbs, SERIALIZABLE_ATTRIBUTES } from './normalise-sentry-breadcrumbs';
5
5
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
6
6
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
7
- const packageVersion = "0.0.0-development";
7
+ const packageVersion = "112.2.3";
8
8
  const sanitiseSentryEvents = (data, _hint) => {
9
9
  // Remove URL as it has UGC
10
10
  // Ignored via go/ees007
@@ -14,7 +14,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
14
14
  import { fg } from '@atlaskit/platform-feature-flags';
15
15
  import Layer from '../Layer';
16
16
  const packageName = "@atlaskit/editor-common";
17
- const packageVersion = "0.0.0-development";
17
+ const packageVersion = "112.2.3";
18
18
  const halfFocusRing = 1;
19
19
  const dropOffset = '0, 8';
20
20
  const fadeIn = keyframes({
@@ -288,7 +288,7 @@ export const isEmptySelectionAtStart = state => {
288
288
 
289
289
  // If blockTaskItem is in the schema,
290
290
  // we need to check if the selection is inside a blockTaskItem
291
- if (blockTaskItem && empty && fg('platform_editor_blocktaskitem_patch_2')) {
291
+ if (blockTaskItem && empty) {
292
292
  // If the parent is in a textblock,
293
293
  // check if it's nested inside a blockTaskItem
294
294
  if ($from.parent.isTextblock) {
@@ -312,17 +312,8 @@ export const isEmptySelectionAtStart = state => {
312
312
  // Else, check if the parent is a blockTaskItem
313
313
  else if ($from.parent.type === blockTaskItem) {
314
314
  // Check if the selection is at the start of the blockTaskItem
315
- let firstPosInBlockTaskItem = 0;
316
- if (fg('platform_editor_blocktaskitem_patch_2')) {
317
- const blockTaskItemDepth = $from.depth;
318
-
319
- // When cleaning up platform_editor_blocktaskitem_patch_2, set firstPosInBlockTaskItem as const
320
- firstPosInBlockTaskItem = $from.start(blockTaskItemDepth);
321
- } else {
322
- const blockTaskItemDepth = $from.depth - 1;
323
- const DISTANCE_FROM_PARENT_FOR_GAP_CURSOR = 1;
324
- firstPosInBlockTaskItem = $from.start(blockTaskItemDepth) + DISTANCE_FROM_PARENT_FOR_GAP_CURSOR;
325
- }
315
+ const blockTaskItemDepth = $from.depth;
316
+ const firstPosInBlockTaskItem = $from.start(blockTaskItemDepth);
326
317
 
327
318
  // Is the selection at the first possible position inside the blockTaskItem
328
319
  return $from.pos === firstPosInBlockTaskItem;
@@ -37,7 +37,7 @@ export var pasteOptionsToolbarMessages = defineMessages({
37
37
  },
38
38
  pasteMenuActionsTitle: {
39
39
  id: 'fabric.editor.pasteMenuActionsTitle',
40
- defaultMessage: 'Actions',
40
+ defaultMessage: 'Paste actions',
41
41
  description: 'Section title for actions in the paste options menu'
42
42
  }
43
43
  });
@@ -10,7 +10,7 @@ import { isFedRamp } from './environment';
10
10
  import { normaliseSentryBreadcrumbs, SERIALIZABLE_ATTRIBUTES } from './normalise-sentry-breadcrumbs';
11
11
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
12
12
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
13
- var packageVersion = "0.0.0-development";
13
+ var packageVersion = "112.2.3";
14
14
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
15
15
  // Remove URL as it has UGC
16
16
  // Ignored via go/ees007
@@ -21,7 +21,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
21
21
  import { fg } from '@atlaskit/platform-feature-flags';
22
22
  import Layer from '../Layer';
23
23
  var packageName = "@atlaskit/editor-common";
24
- var packageVersion = "0.0.0-development";
24
+ var packageVersion = "112.2.3";
25
25
  var halfFocusRing = 1;
26
26
  var dropOffset = '0, 8';
27
27
  var fadeIn = keyframes({
@@ -272,7 +272,7 @@ export var isEmptySelectionAtStart = function isEmptySelectionAtStart(state) {
272
272
 
273
273
  // If blockTaskItem is in the schema,
274
274
  // we need to check if the selection is inside a blockTaskItem
275
- if (blockTaskItem && empty && fg('platform_editor_blocktaskitem_patch_2')) {
275
+ if (blockTaskItem && empty) {
276
276
  // If the parent is in a textblock,
277
277
  // check if it's nested inside a blockTaskItem
278
278
  if ($from.parent.isTextblock) {
@@ -296,17 +296,8 @@ export var isEmptySelectionAtStart = function isEmptySelectionAtStart(state) {
296
296
  // Else, check if the parent is a blockTaskItem
297
297
  else if ($from.parent.type === blockTaskItem) {
298
298
  // Check if the selection is at the start of the blockTaskItem
299
- var firstPosInBlockTaskItem = 0;
300
- if (fg('platform_editor_blocktaskitem_patch_2')) {
301
- var blockTaskItemDepth = $from.depth;
302
-
303
- // When cleaning up platform_editor_blocktaskitem_patch_2, set firstPosInBlockTaskItem as const
304
- firstPosInBlockTaskItem = $from.start(blockTaskItemDepth);
305
- } else {
306
- var _blockTaskItemDepth = $from.depth - 1;
307
- var DISTANCE_FROM_PARENT_FOR_GAP_CURSOR = 1;
308
- firstPosInBlockTaskItem = $from.start(_blockTaskItemDepth) + DISTANCE_FROM_PARENT_FOR_GAP_CURSOR;
309
- }
299
+ var blockTaskItemDepth = $from.depth;
300
+ var firstPosInBlockTaskItem = $from.start(blockTaskItemDepth);
310
301
 
311
302
  // Is the selection at the first possible position inside the blockTaskItem
312
303
  return $from.pos === firstPosInBlockTaskItem;
@@ -2,7 +2,7 @@ export type { CardOptions, OnClickCallback } from './cardOptions';
2
2
  export { addLinkMetadata, getLinkMetadataFromTransaction, commandWithMetadata } from './utils';
3
3
  export { default as buildLayoutButtons, alignmentIcons, wrappingIcons, layoutToMessages, buildLayoutDropdown, } from './MediaAndEmbedsToolbar';
4
4
  export type { IconMap, LayoutIcon } from './MediaAndEmbedsToolbar';
5
- export type { OptionConfig, CardPluginActions, QueueCardsFromTransactionAction, HideLinkToolbarAction, ChangeSelectedCardToLink, SetSelectedCardAppearance, CardReplacementInputMethod, } from './types';
5
+ export type { OptionConfig, CardPluginActions, QueueCardsFromTransactionAction, HideLinkToolbarAction, ChangeSelectedCardToLink, SetSelectedCardAppearance, CardReplacementInputMethod, EmbedCardTransformAttrs, EmbedCardNodeTransformer, EmbedCardTransformCommandOptions, CreateEmbedCardTransformCommand, EmbedCardTransformers, } from './types';
6
6
  export { LinkToolbarButtonGroup } from './LinkToolbarButtonGroup';
7
7
  export { appearancePropsMap, getButtonGroupOption } from './link-toolbar-button-group-options';
8
8
  export { getDropdownOption } from './link-toolbar-dropdown-options';
@@ -1,6 +1,6 @@
1
1
  import { type IntlShape } from 'react-intl-next';
2
2
  import type { UIAnalyticsEvent } from '@atlaskit/analytics-next';
3
- import type { Node } from '@atlaskit/editor-prosemirror/model';
3
+ import type { Node, Schema } from '@atlaskit/editor-prosemirror/model';
4
4
  import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
5
5
  import type { ACTION, EditorAnalyticsAPI, INPUT_METHOD } from '../analytics';
6
6
  import { type CardAppearance, type CardProvider } from '../provider-factory';
@@ -26,10 +26,52 @@ export type GetStartingToolbarItems = (intl: IntlShape, link: string, onEditLink
26
26
  url: string;
27
27
  }, state?: EditorState) => FloatingToolbarItem<Command>[];
28
28
  export type GetEndingToolbarItems = (intl: IntlShape, link: string) => FloatingToolbarItem<Command>[];
29
+ /**
30
+ * Attributes passed to an embed card node transformer.
31
+ * Contains the URL and layout information needed to transform
32
+ * an embedCard into an alternative node representation.
33
+ */
34
+ export type EmbedCardTransformAttrs = {
35
+ layout?: string;
36
+ originalHeight?: number | null;
37
+ originalWidth?: number | null;
38
+ url: string;
39
+ width?: number;
40
+ };
41
+ /**
42
+ * A generic transformer function that converts embed card attributes into
43
+ * an alternative ProseMirror Node (e.g. a native embed extension node).
44
+ *
45
+ * Returns undefined if the URL is not supported or transformation is not possible.
46
+ */
47
+ export type EmbedCardNodeTransformer = (schema: Schema, attrs: EmbedCardTransformAttrs) => Node | undefined;
48
+ /**
49
+ * Options for creating a transform command that replaces a selected card node
50
+ * with an alternative node representation.
51
+ */
52
+ export type EmbedCardTransformCommandOptions = {
53
+ /**
54
+ * Callback to augment the transaction with additional concerns
55
+ * (e.g. analytics events, datasource stash updates, link metadata).
56
+ */
57
+ augmentTransaction?: (tr: Transaction, state: EditorState) => void;
58
+ };
59
+ /**
60
+ * A factory function that creates a Command to replace the currently selected
61
+ * card node with an alternative node representation (e.g. a native embed).
62
+ *
63
+ * The returned command should return false if transformation is not possible.
64
+ */
65
+ export type CreateEmbedCardTransformCommand = (options?: EmbedCardTransformCommandOptions) => Command;
66
+ export interface EmbedCardTransformers {
67
+ createEmbedCardTransformCommand: CreateEmbedCardTransformCommand;
68
+ embedCardNodeTransformer: EmbedCardNodeTransformer;
69
+ }
29
70
  export type CardPluginActions = {
30
71
  getEndingToolbarItems: GetEndingToolbarItems;
31
72
  getStartingToolbarItems: GetStartingToolbarItems;
32
73
  hideLinkToolbar: HideLinkToolbarAction;
33
74
  queueCardsFromChangedTr: QueueCardsFromTransactionAction;
75
+ registerEmbedCardTransformer: (transformers: EmbedCardTransformers) => void;
34
76
  setProvider: (provider: Promise<CardProvider>) => Promise<boolean>;
35
77
  };
@@ -2,7 +2,7 @@ export type { CardOptions, OnClickCallback } from './cardOptions';
2
2
  export { addLinkMetadata, getLinkMetadataFromTransaction, commandWithMetadata } from './utils';
3
3
  export { default as buildLayoutButtons, alignmentIcons, wrappingIcons, layoutToMessages, buildLayoutDropdown, } from './MediaAndEmbedsToolbar';
4
4
  export type { IconMap, LayoutIcon } from './MediaAndEmbedsToolbar';
5
- export type { OptionConfig, CardPluginActions, QueueCardsFromTransactionAction, HideLinkToolbarAction, ChangeSelectedCardToLink, SetSelectedCardAppearance, CardReplacementInputMethod, } from './types';
5
+ export type { OptionConfig, CardPluginActions, QueueCardsFromTransactionAction, HideLinkToolbarAction, ChangeSelectedCardToLink, SetSelectedCardAppearance, CardReplacementInputMethod, EmbedCardTransformAttrs, EmbedCardNodeTransformer, EmbedCardTransformCommandOptions, CreateEmbedCardTransformCommand, EmbedCardTransformers, } from './types';
6
6
  export { LinkToolbarButtonGroup } from './LinkToolbarButtonGroup';
7
7
  export { appearancePropsMap, getButtonGroupOption } from './link-toolbar-button-group-options';
8
8
  export { getDropdownOption } from './link-toolbar-dropdown-options';
@@ -1,6 +1,6 @@
1
1
  import { type IntlShape } from 'react-intl-next';
2
2
  import type { UIAnalyticsEvent } from '@atlaskit/analytics-next';
3
- import type { Node } from '@atlaskit/editor-prosemirror/model';
3
+ import type { Node, Schema } from '@atlaskit/editor-prosemirror/model';
4
4
  import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
5
5
  import type { ACTION, EditorAnalyticsAPI, INPUT_METHOD } from '../analytics';
6
6
  import { type CardAppearance, type CardProvider } from '../provider-factory';
@@ -26,10 +26,52 @@ export type GetStartingToolbarItems = (intl: IntlShape, link: string, onEditLink
26
26
  url: string;
27
27
  }, state?: EditorState) => FloatingToolbarItem<Command>[];
28
28
  export type GetEndingToolbarItems = (intl: IntlShape, link: string) => FloatingToolbarItem<Command>[];
29
+ /**
30
+ * Attributes passed to an embed card node transformer.
31
+ * Contains the URL and layout information needed to transform
32
+ * an embedCard into an alternative node representation.
33
+ */
34
+ export type EmbedCardTransformAttrs = {
35
+ layout?: string;
36
+ originalHeight?: number | null;
37
+ originalWidth?: number | null;
38
+ url: string;
39
+ width?: number;
40
+ };
41
+ /**
42
+ * A generic transformer function that converts embed card attributes into
43
+ * an alternative ProseMirror Node (e.g. a native embed extension node).
44
+ *
45
+ * Returns undefined if the URL is not supported or transformation is not possible.
46
+ */
47
+ export type EmbedCardNodeTransformer = (schema: Schema, attrs: EmbedCardTransformAttrs) => Node | undefined;
48
+ /**
49
+ * Options for creating a transform command that replaces a selected card node
50
+ * with an alternative node representation.
51
+ */
52
+ export type EmbedCardTransformCommandOptions = {
53
+ /**
54
+ * Callback to augment the transaction with additional concerns
55
+ * (e.g. analytics events, datasource stash updates, link metadata).
56
+ */
57
+ augmentTransaction?: (tr: Transaction, state: EditorState) => void;
58
+ };
59
+ /**
60
+ * A factory function that creates a Command to replace the currently selected
61
+ * card node with an alternative node representation (e.g. a native embed).
62
+ *
63
+ * The returned command should return false if transformation is not possible.
64
+ */
65
+ export type CreateEmbedCardTransformCommand = (options?: EmbedCardTransformCommandOptions) => Command;
66
+ export interface EmbedCardTransformers {
67
+ createEmbedCardTransformCommand: CreateEmbedCardTransformCommand;
68
+ embedCardNodeTransformer: EmbedCardNodeTransformer;
69
+ }
29
70
  export type CardPluginActions = {
30
71
  getEndingToolbarItems: GetEndingToolbarItems;
31
72
  getStartingToolbarItems: GetStartingToolbarItems;
32
73
  hideLinkToolbar: HideLinkToolbarAction;
33
74
  queueCardsFromChangedTr: QueueCardsFromTransactionAction;
75
+ registerEmbedCardTransformer: (transformers: EmbedCardTransformers) => void;
34
76
  setProvider: (provider: Promise<CardProvider>) => Promise<boolean>;
35
77
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "112.2.3",
3
+ "version": "112.3.0",
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/"
@@ -42,7 +42,7 @@
42
42
  "@atlaskit/codemod-utils": "^4.2.0",
43
43
  "@atlaskit/css": "^0.19.0",
44
44
  "@atlaskit/custom-steps": "^0.16.0",
45
- "@atlaskit/dropdown-menu": "^16.6.0",
45
+ "@atlaskit/dropdown-menu": "^16.7.0",
46
46
  "@atlaskit/editor-json-transformer": "^8.31.0",
47
47
  "@atlaskit/editor-palette": "^2.1.0",
48
48
  "@atlaskit/editor-prosemirror": "^7.3.0",
@@ -51,7 +51,7 @@
51
51
  "@atlaskit/editor-toolbar": "^0.19.0",
52
52
  "@atlaskit/editor-toolbar-model": "^0.4.0",
53
53
  "@atlaskit/emoji": "^69.10.0",
54
- "@atlaskit/icon": "^32.0.0",
54
+ "@atlaskit/icon": "^32.1.0",
55
55
  "@atlaskit/icon-object": "^7.4.0",
56
56
  "@atlaskit/link": "^3.3.0",
57
57
  "@atlaskit/link-datasource": "^4.34.0",
@@ -82,7 +82,7 @@
82
82
  "@atlaskit/task-decision": "^19.3.0",
83
83
  "@atlaskit/textfield": "^8.2.0",
84
84
  "@atlaskit/theme": "^22.0.0",
85
- "@atlaskit/tmp-editor-statsig": "^38.0.0",
85
+ "@atlaskit/tmp-editor-statsig": "^38.1.0",
86
86
  "@atlaskit/tokens": "^11.1.0",
87
87
  "@atlaskit/tooltip": "^20.14.0",
88
88
  "@atlaskit/width-detector": "^5.0.0",
@@ -172,9 +172,6 @@
172
172
  "platform_editor_typography_ugc": {
173
173
  "type": "boolean"
174
174
  },
175
- "platform_editor_blocktaskitem_patch_2": {
176
- "type": "boolean"
177
- },
178
175
  "platform_editor_blocktaskitem_patch_3": {
179
176
  "type": "boolean"
180
177
  },