@atlaskit/editor-common 102.5.3 → 102.7.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,22 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 102.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#124569](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/124569)
8
+ [`d88099abc9365`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d88099abc9365) -
9
+ Support Renderer to override bodies for multiBodiedExtensions
10
+
11
+ ## 102.6.0
12
+
13
+ ### Minor Changes
14
+
15
+ - [#126044](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/126044)
16
+ [`c397a5e304fa9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c397a5e304fa9) -
17
+ ED-26926 Moved findInsertLocation to editor-common and used it to add insertLocation to extension
18
+ insertion analytics
19
+
3
20
  ## 102.5.3
4
21
 
5
22
  ### Patch Changes
@@ -78,8 +78,6 @@ function _getExtensionModuleNodePrivateProps() {
78
78
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
79
79
  acc[key] = moduleNode[key];
80
80
  return acc;
81
- // Ignored via go/ees005
82
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
83
81
  }, {}));
84
82
  case 4:
85
83
  case "end":
@@ -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 = "102.5.3";
20
+ var packageVersion = "102.7.0";
21
21
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
22
22
  // Remove URL as it has UGC
23
23
  // 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 = "102.5.3";
26
+ var packageVersion = "102.7.0";
27
27
  var halfFocusRing = 1;
28
28
  var dropOffset = '0, 8';
29
29
  // Ignored via go/ees005
@@ -3,8 +3,13 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getAnalyticsEventSeverity = exports.getAnalyticsEditorAppearance = exports.getAnalyticsAppearance = exports.analyticsEventKey = exports.SEVERITY = void 0;
6
+ exports.analyticsEventKey = exports.SEVERITY = void 0;
7
+ exports.findInsertLocation = findInsertLocation;
8
+ exports.getAnalyticsEventSeverity = exports.getAnalyticsEditorAppearance = exports.getAnalyticsAppearance = void 0;
7
9
  var _FabricEditorAnalyticsContext = require("@atlaskit/analytics-namespaced-context/FabricEditorAnalyticsContext");
10
+ var _state = require("@atlaskit/editor-prosemirror/state");
11
+ var _utils = require("@atlaskit/editor-prosemirror/utils");
12
+ var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
8
13
  var getAnalyticsAppearance = exports.getAnalyticsAppearance = function getAnalyticsAppearance(appearance) {
9
14
  switch (appearance) {
10
15
  case 'full-page':
@@ -31,6 +36,23 @@ var getAnalyticsEventSeverity = exports.getAnalyticsEventSeverity = function get
31
36
  }
32
37
  return SEVERITY.NORMAL;
33
38
  };
39
+ function findInsertLocation(selection) {
40
+ var _selection$$from$doc$ = selection.$from.doc.type,
41
+ schema = _selection$$from$doc$.schema,
42
+ name = _selection$$from$doc$.name;
43
+ if (selection instanceof _state.NodeSelection) {
44
+ return selection.node.type.name;
45
+ }
46
+ if (selection instanceof _cellSelection.CellSelection) {
47
+ return schema.nodes.table.name;
48
+ }
49
+
50
+ // Text selection
51
+ var parentNodeInfo = (0, _utils.findParentNode)(function (node) {
52
+ return node.type !== schema.nodes.paragraph;
53
+ })(selection);
54
+ return parentNodeInfo ? parentNodeInfo.node.type.name : name;
55
+ }
34
56
  var SEVERITY = exports.SEVERITY = /*#__PURE__*/function (SEVERITY) {
35
57
  SEVERITY["NORMAL"] = "normal";
36
58
  SEVERITY["DEGRADED"] = "degraded";
@@ -27,8 +27,6 @@ export async function getExtensionModuleNodePrivateProps(extensionProvider, exte
27
27
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
28
28
  acc[key] = moduleNode[key];
29
29
  return acc;
30
- // Ignored via go/ees005
31
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
32
30
  }, {});
33
31
  }
34
32
  function ExtensionLoading(props) {
@@ -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 = "102.5.3";
4
+ const packageVersion = "102.7.0";
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 = "102.5.3";
16
+ const packageVersion = "102.7.0";
17
17
  const halfFocusRing = 1;
18
18
  const dropOffset = '0, 8';
19
19
  // Ignored via go/ees005
@@ -1,4 +1,7 @@
1
1
  import { EDITOR_APPEARANCE_CONTEXT } from '@atlaskit/analytics-namespaced-context/FabricEditorAnalyticsContext';
2
+ import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
3
+ import { findParentNode } from '@atlaskit/editor-prosemirror/utils';
4
+ import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
2
5
  export const getAnalyticsAppearance = appearance => {
3
6
  switch (appearance) {
4
7
  case 'full-page':
@@ -23,6 +26,22 @@ export const getAnalyticsEventSeverity = (duration, normalThreshold, degradedThr
23
26
  }
24
27
  return SEVERITY.NORMAL;
25
28
  };
29
+ export function findInsertLocation(selection) {
30
+ const {
31
+ schema,
32
+ name
33
+ } = selection.$from.doc.type;
34
+ if (selection instanceof NodeSelection) {
35
+ return selection.node.type.name;
36
+ }
37
+ if (selection instanceof CellSelection) {
38
+ return schema.nodes.table.name;
39
+ }
40
+
41
+ // Text selection
42
+ const parentNodeInfo = findParentNode(node => node.type !== schema.nodes.paragraph)(selection);
43
+ return parentNodeInfo ? parentNodeInfo.node.type.name : name;
44
+ }
26
45
  export let SEVERITY = /*#__PURE__*/function (SEVERITY) {
27
46
  SEVERITY["NORMAL"] = "normal";
28
47
  SEVERITY["DEGRADED"] = "degraded";
@@ -70,8 +70,6 @@ function _getExtensionModuleNodePrivateProps() {
70
70
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
71
71
  acc[key] = moduleNode[key];
72
72
  return acc;
73
- // Ignored via go/ees005
74
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
75
73
  }, {}));
76
74
  case 4:
77
75
  case "end":
@@ -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 = "102.5.3";
10
+ var packageVersion = "102.7.0";
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 = "102.5.3";
23
+ var packageVersion = "102.7.0";
24
24
  var halfFocusRing = 1;
25
25
  var dropOffset = '0, 8';
26
26
  // Ignored via go/ees005
@@ -1,4 +1,7 @@
1
1
  import { EDITOR_APPEARANCE_CONTEXT } from '@atlaskit/analytics-namespaced-context/FabricEditorAnalyticsContext';
2
+ import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
3
+ import { findParentNode } from '@atlaskit/editor-prosemirror/utils';
4
+ import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
2
5
  export var getAnalyticsAppearance = function getAnalyticsAppearance(appearance) {
3
6
  switch (appearance) {
4
7
  case 'full-page':
@@ -25,6 +28,23 @@ export var getAnalyticsEventSeverity = function getAnalyticsEventSeverity(durati
25
28
  }
26
29
  return SEVERITY.NORMAL;
27
30
  };
31
+ export function findInsertLocation(selection) {
32
+ var _selection$$from$doc$ = selection.$from.doc.type,
33
+ schema = _selection$$from$doc$.schema,
34
+ name = _selection$$from$doc$.name;
35
+ if (selection instanceof NodeSelection) {
36
+ return selection.node.type.name;
37
+ }
38
+ if (selection instanceof CellSelection) {
39
+ return schema.nodes.table.name;
40
+ }
41
+
42
+ // Text selection
43
+ var parentNodeInfo = findParentNode(function (node) {
44
+ return node.type !== schema.nodes.paragraph;
45
+ })(selection);
46
+ return parentNodeInfo ? parentNodeInfo.node.type.name : name;
47
+ }
28
48
  export var SEVERITY = /*#__PURE__*/function (SEVERITY) {
29
49
  SEVERITY["NORMAL"] = "normal";
30
50
  SEVERITY["DEGRADED"] = "degraded";
@@ -8,7 +8,9 @@ export declare function getExtensionModuleNode(extensionProvider: ExtensionProvi
8
8
  /**
9
9
  * Gets `__` prefixed properties from an extension node module definition
10
10
  */
11
- export declare function getExtensionModuleNodePrivateProps(extensionProvider: ExtensionProvider, extensionType: ExtensionType, extensionKey: ExtensionKey): Promise<any>;
11
+ export declare function getExtensionModuleNodePrivateProps(extensionProvider: ExtensionProvider, extensionType: ExtensionType, extensionKey: ExtensionKey): Promise<{
12
+ [prop: string]: any;
13
+ }>;
12
14
  export declare function getNodeRenderer<T extends Parameters>(extensionProvider: ExtensionProvider, extensionType: ExtensionType, extensionKey: ExtensionKey): React.ComponentType<{
13
15
  node: ExtensionParams<T>;
14
16
  references?: ReferenceEntity[] | undefined;
@@ -1,7 +1,9 @@
1
1
  import { EDITOR_APPEARANCE_CONTEXT } from '@atlaskit/analytics-namespaced-context/FabricEditorAnalyticsContext';
2
+ import type { Selection } from '@atlaskit/editor-prosemirror/state';
2
3
  export declare const getAnalyticsAppearance: (appearance?: string) => EDITOR_APPEARANCE_CONTEXT | undefined;
3
4
  export declare const getAnalyticsEditorAppearance: (editorAppearance?: string) => string;
4
5
  export declare const getAnalyticsEventSeverity: (duration: number, normalThreshold: number, degradedThreshold: number) => SEVERITY;
6
+ export declare function findInsertLocation(selection: Selection): string;
5
7
  export declare enum SEVERITY {
6
8
  NORMAL = "normal",
7
9
  DEGRADED = "degraded",
@@ -8,7 +8,9 @@ export declare function getExtensionModuleNode(extensionProvider: ExtensionProvi
8
8
  /**
9
9
  * Gets `__` prefixed properties from an extension node module definition
10
10
  */
11
- export declare function getExtensionModuleNodePrivateProps(extensionProvider: ExtensionProvider, extensionType: ExtensionType, extensionKey: ExtensionKey): Promise<any>;
11
+ export declare function getExtensionModuleNodePrivateProps(extensionProvider: ExtensionProvider, extensionType: ExtensionType, extensionKey: ExtensionKey): Promise<{
12
+ [prop: string]: any;
13
+ }>;
12
14
  export declare function getNodeRenderer<T extends Parameters>(extensionProvider: ExtensionProvider, extensionType: ExtensionType, extensionKey: ExtensionKey): React.ComponentType<{
13
15
  node: ExtensionParams<T>;
14
16
  references?: ReferenceEntity[] | undefined;
@@ -1,7 +1,9 @@
1
1
  import { EDITOR_APPEARANCE_CONTEXT } from '@atlaskit/analytics-namespaced-context/FabricEditorAnalyticsContext';
2
+ import type { Selection } from '@atlaskit/editor-prosemirror/state';
2
3
  export declare const getAnalyticsAppearance: (appearance?: string) => EDITOR_APPEARANCE_CONTEXT | undefined;
3
4
  export declare const getAnalyticsEditorAppearance: (editorAppearance?: string) => string;
4
5
  export declare const getAnalyticsEventSeverity: (duration: number, normalThreshold: number, degradedThreshold: number) => SEVERITY;
6
+ export declare function findInsertLocation(selection: Selection): string;
5
7
  export declare enum SEVERITY {
6
8
  NORMAL = "normal",
7
9
  DEGRADED = "degraded",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "102.5.3",
3
+ "version": "102.7.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/"