@atlaskit/editor-common 114.22.0 → 114.23.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,20 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 114.23.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`ec2b181d84b9e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ec2b181d84b9e) -
8
+ EDITOR-4648 fix native anchor in SSR
9
+
10
+ ## 114.22.1
11
+
12
+ ### Patch Changes
13
+
14
+ - [`51a4f923f5d1f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/51a4f923f5d1f) -
15
+ Removed Suggested Edits quick insert
16
+ - Updated dependencies
17
+
3
18
  ## 114.22.0
4
19
 
5
20
  ### Minor Changes
@@ -66,16 +66,6 @@ var aiSuggestionsMessages = exports.aiSuggestionsMessages = (0, _reactIntl.defin
66
66
  defaultMessage: '{count} suggestions',
67
67
  description: 'Tooltip text for the suggestion icon button when there are multiple AI suggestions'
68
68
  },
69
- fetchGenerateFromDocument: {
70
- id: 'fabric.editor.ai.suggestions.quickInsert.generateFromDocument.non-final',
71
- defaultMessage: 'Suggested edits (generate)',
72
- description: 'Quick insert: fetch AI suggestions by generating from the current document (ADF)'
73
- },
74
- fetchGenerateFromAdf: {
75
- id: 'fabric.editor.ai.suggestions.quickInsert.generateFromAdf.non-final',
76
- defaultMessage: 'Suggested edits (generate from ADF)',
77
- description: 'Quick insert: fetch AI suggestions by generating from document, same as page toolbar action'
78
- },
79
69
  originalViewLabel: {
80
70
  id: 'fabric.editor.ai.suggestions.stagingArea.originalViewLabel.non-final',
81
71
  defaultMessage: 'Original • View only',
@@ -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 = "114.22.1";
23
23
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
24
24
  // Remove URL as it has UGC
25
25
  // Ignored via go/ees007
@@ -14,7 +14,9 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
14
14
  var _toArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toArray"));
15
15
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
16
16
  var _state = require("@atlaskit/editor-prosemirror/state");
17
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
17
18
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
19
+ var _isSsr = require("../core-utils/is-ssr");
18
20
  var _nodeAnchorProvider = require("../node-anchor/node-anchor-provider");
19
21
  var _prosemirrorDomMetadata = require("../prosemirror-dom-metadata");
20
22
  var _nativeAnchor = require("../styles/shared/native-anchor");
@@ -56,6 +58,16 @@ var attachGenericProseMirrorMetadata = exports.attachGenericProseMirrorMetadata
56
58
  });
57
59
  };
58
60
 
61
+ /** Type guard to check if a Node is an HTMLElement in a safe way. */
62
+ var isHTMLElement = function isHTMLElement(element) {
63
+ if (element === null || element === undefined) {
64
+ return false;
65
+ }
66
+
67
+ // In SSR `HTMLElement` is not defined, so we need to use duck typing here
68
+ return 'innerHTML' in element && 'style' in element && 'classList' in element;
69
+ };
70
+
59
71
  // Wraper to avoid any exception during the get pos operation
60
72
  // See this https://hello.atlassian.net/wiki/spaces/EDITOR/pages/2849713193/ED-19672+Extensions+Regression
61
73
  // And this https://discuss.prosemirror.net/t/possible-bug-on-viewdesc-posbeforechild/5783
@@ -88,7 +100,9 @@ var wrapGetPosExceptions = function wrapGetPosExceptions(spec) {
88
100
  // eslint-disable-next-line no-extra-bind
89
101
  }.bind(thisArg);
90
102
  var result = Reflect.apply(target, thisArg, [node, view, safeGetPos].concat((0, _toConsumableArray2.default)(more)));
91
- if ((result === null || result === void 0 ? void 0 : result.dom) instanceof HTMLElement) {
103
+ if ((result === null || result === void 0 ? void 0 : result.dom) instanceof HTMLElement ||
104
+ // SSR result?.dom is not an instance of HTMLElement, but we still want to attach metadata to it
105
+ (0, _isSsr.isSSR)() && isHTMLElement(result === null || result === void 0 ? void 0 : result.dom) && (0, _platformFeatureFlags.fg)('platform_editor_native_anchor_patch_3')) {
92
106
  var _nodeIdProvider;
93
107
  // we only attach metadata to the dom if its position is known
94
108
  var pos = safeGetPos();
@@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.CodeBlockSharedCssClassName = void 0;
7
+ // Constant variables here has been inlined in css from EditorContentContainer, if you need to make
8
+ // update here, please also update packages/editor/editor-core/src/ui/EditorContentContainer/EditorContentContainer-compiled.tsx
7
9
  var CodeBlockSharedCssClassName = exports.CodeBlockSharedCssClassName = {
8
10
  CODEBLOCK_CONTAINER: 'code-block',
9
11
  CODEBLOCK_START: 'code-block--start',
@@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.SmartCardSharedCssClassName = void 0;
7
+ // Constant variables here has been inlined in css from EditorContentContainer, if you need to make
8
+ // update here, please also update packages/editor/editor-core/src/ui/EditorContentContainer/EditorContentContainer-compiled.tsx
7
9
  var SmartCardSharedCssClassName = exports.SmartCardSharedCssClassName = {
8
10
  INLINE_CARD_CONTAINER: 'inlineCardView-content-wrap',
9
11
  BLOCK_CARD_CONTAINER: 'blockCardView-content-wrap',
@@ -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 = "114.22.1";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var fadeIn = (0, _react2.keyframes)({
@@ -60,16 +60,6 @@ export const aiSuggestionsMessages = defineMessages({
60
60
  defaultMessage: '{count} suggestions',
61
61
  description: 'Tooltip text for the suggestion icon button when there are multiple AI suggestions'
62
62
  },
63
- fetchGenerateFromDocument: {
64
- id: 'fabric.editor.ai.suggestions.quickInsert.generateFromDocument.non-final',
65
- defaultMessage: 'Suggested edits (generate)',
66
- description: 'Quick insert: fetch AI suggestions by generating from the current document (ADF)'
67
- },
68
- fetchGenerateFromAdf: {
69
- id: 'fabric.editor.ai.suggestions.quickInsert.generateFromAdf.non-final',
70
- defaultMessage: 'Suggested edits (generate from ADF)',
71
- description: 'Quick insert: fetch AI suggestions by generating from document, same as page toolbar action'
72
- },
73
63
  originalViewLabel: {
74
64
  id: 'fabric.editor.ai.suggestions.stagingArea.originalViewLabel.non-final',
75
65
  defaultMessage: 'Original • View only',
@@ -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 = "114.22.1";
8
8
  const sanitiseSentryEvents = (data, _hint) => {
9
9
  // Remove URL as it has UGC
10
10
  // Ignored via go/ees007
@@ -1,5 +1,7 @@
1
1
  import { Plugin } from '@atlaskit/editor-prosemirror/state';
2
+ import { fg } from '@atlaskit/platform-feature-flags';
2
3
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
4
+ import { isSSR } from '../core-utils/is-ssr';
3
5
  import { getNodeIdProvider } from '../node-anchor/node-anchor-provider';
4
6
  import { createProseMirrorMetadata } from '../prosemirror-dom-metadata';
5
7
  import { ANCHOR_VARIABLE_NAME, isCSSAnchorSupported, isCSSAttrAnchorSupported } from '../styles/shared/native-anchor';
@@ -37,6 +39,16 @@ export const attachGenericProseMirrorMetadata = ({
37
39
  });
38
40
  };
39
41
 
42
+ /** Type guard to check if a Node is an HTMLElement in a safe way. */
43
+ const isHTMLElement = element => {
44
+ if (element === null || element === undefined) {
45
+ return false;
46
+ }
47
+
48
+ // In SSR `HTMLElement` is not defined, so we need to use duck typing here
49
+ return 'innerHTML' in element && 'style' in element && 'classList' in element;
50
+ };
51
+
40
52
  // Wraper to avoid any exception during the get pos operation
41
53
  // See this https://hello.atlassian.net/wiki/spaces/EDITOR/pages/2849713193/ED-19672+Extensions+Regression
42
54
  // And this https://discuss.prosemirror.net/t/possible-bug-on-viewdesc-posbeforechild/5783
@@ -65,7 +77,9 @@ const wrapGetPosExceptions = spec => {
65
77
  // eslint-disable-next-line no-extra-bind
66
78
  }).bind(thisArg);
67
79
  const result = Reflect.apply(target, thisArg, [node, view, safeGetPos, ...more]);
68
- if ((result === null || result === void 0 ? void 0 : result.dom) instanceof HTMLElement) {
80
+ if ((result === null || result === void 0 ? void 0 : result.dom) instanceof HTMLElement ||
81
+ // SSR result?.dom is not an instance of HTMLElement, but we still want to attach metadata to it
82
+ isSSR() && isHTMLElement(result === null || result === void 0 ? void 0 : result.dom) && fg('platform_editor_native_anchor_patch_3')) {
69
83
  var _nodeIdProvider;
70
84
  // we only attach metadata to the dom if its position is known
71
85
  const pos = safeGetPos();
@@ -1,3 +1,5 @@
1
+ // Constant variables here has been inlined in css from EditorContentContainer, if you need to make
2
+ // update here, please also update packages/editor/editor-core/src/ui/EditorContentContainer/EditorContentContainer-compiled.tsx
1
3
  export const CodeBlockSharedCssClassName = {
2
4
  CODEBLOCK_CONTAINER: 'code-block',
3
5
  CODEBLOCK_START: 'code-block--start',
@@ -1,3 +1,5 @@
1
+ // Constant variables here has been inlined in css from EditorContentContainer, if you need to make
2
+ // update here, please also update packages/editor/editor-core/src/ui/EditorContentContainer/EditorContentContainer-compiled.tsx
1
3
  export const SmartCardSharedCssClassName = {
2
4
  INLINE_CARD_CONTAINER: 'inlineCardView-content-wrap',
3
5
  BLOCK_CARD_CONTAINER: 'blockCardView-content-wrap',
@@ -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 = "114.22.1";
18
18
  const halfFocusRing = 1;
19
19
  const dropOffset = '0, 8';
20
20
  const fadeIn = keyframes({
@@ -60,16 +60,6 @@ export var aiSuggestionsMessages = defineMessages({
60
60
  defaultMessage: '{count} suggestions',
61
61
  description: 'Tooltip text for the suggestion icon button when there are multiple AI suggestions'
62
62
  },
63
- fetchGenerateFromDocument: {
64
- id: 'fabric.editor.ai.suggestions.quickInsert.generateFromDocument.non-final',
65
- defaultMessage: 'Suggested edits (generate)',
66
- description: 'Quick insert: fetch AI suggestions by generating from the current document (ADF)'
67
- },
68
- fetchGenerateFromAdf: {
69
- id: 'fabric.editor.ai.suggestions.quickInsert.generateFromAdf.non-final',
70
- defaultMessage: 'Suggested edits (generate from ADF)',
71
- description: 'Quick insert: fetch AI suggestions by generating from document, same as page toolbar action'
72
- },
73
63
  originalViewLabel: {
74
64
  id: 'fabric.editor.ai.suggestions.stagingArea.originalViewLabel.non-final',
75
65
  defaultMessage: 'Original • View only',
@@ -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 = "114.22.1";
14
14
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
15
15
  // Remove URL as it has UGC
16
16
  // Ignored via go/ees007
@@ -9,7 +9,9 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
9
9
  function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
10
10
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
11
11
  import { Plugin } from '@atlaskit/editor-prosemirror/state';
12
+ import { fg } from '@atlaskit/platform-feature-flags';
12
13
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
14
+ import { isSSR } from '../core-utils/is-ssr';
13
15
  import { getNodeIdProvider } from '../node-anchor/node-anchor-provider';
14
16
  import { createProseMirrorMetadata } from '../prosemirror-dom-metadata';
15
17
  import { ANCHOR_VARIABLE_NAME, isCSSAnchorSupported, isCSSAttrAnchorSupported } from '../styles/shared/native-anchor';
@@ -49,6 +51,16 @@ export var attachGenericProseMirrorMetadata = function attachGenericProseMirrorM
49
51
  });
50
52
  };
51
53
 
54
+ /** Type guard to check if a Node is an HTMLElement in a safe way. */
55
+ var isHTMLElement = function isHTMLElement(element) {
56
+ if (element === null || element === undefined) {
57
+ return false;
58
+ }
59
+
60
+ // In SSR `HTMLElement` is not defined, so we need to use duck typing here
61
+ return 'innerHTML' in element && 'style' in element && 'classList' in element;
62
+ };
63
+
52
64
  // Wraper to avoid any exception during the get pos operation
53
65
  // See this https://hello.atlassian.net/wiki/spaces/EDITOR/pages/2849713193/ED-19672+Extensions+Regression
54
66
  // And this https://discuss.prosemirror.net/t/possible-bug-on-viewdesc-posbeforechild/5783
@@ -81,7 +93,9 @@ var wrapGetPosExceptions = function wrapGetPosExceptions(spec) {
81
93
  // eslint-disable-next-line no-extra-bind
82
94
  }.bind(thisArg);
83
95
  var result = Reflect.apply(target, thisArg, [node, view, safeGetPos].concat(_toConsumableArray(more)));
84
- if ((result === null || result === void 0 ? void 0 : result.dom) instanceof HTMLElement) {
96
+ if ((result === null || result === void 0 ? void 0 : result.dom) instanceof HTMLElement ||
97
+ // SSR result?.dom is not an instance of HTMLElement, but we still want to attach metadata to it
98
+ isSSR() && isHTMLElement(result === null || result === void 0 ? void 0 : result.dom) && fg('platform_editor_native_anchor_patch_3')) {
85
99
  var _nodeIdProvider;
86
100
  // we only attach metadata to the dom if its position is known
87
101
  var pos = safeGetPos();
@@ -1,3 +1,5 @@
1
+ // Constant variables here has been inlined in css from EditorContentContainer, if you need to make
2
+ // update here, please also update packages/editor/editor-core/src/ui/EditorContentContainer/EditorContentContainer-compiled.tsx
1
3
  export var CodeBlockSharedCssClassName = {
2
4
  CODEBLOCK_CONTAINER: 'code-block',
3
5
  CODEBLOCK_START: 'code-block--start',
@@ -1,3 +1,5 @@
1
+ // Constant variables here has been inlined in css from EditorContentContainer, if you need to make
2
+ // update here, please also update packages/editor/editor-core/src/ui/EditorContentContainer/EditorContentContainer-compiled.tsx
1
3
  export var SmartCardSharedCssClassName = {
2
4
  INLINE_CARD_CONTAINER: 'inlineCardView-content-wrap',
3
5
  BLOCK_CARD_CONTAINER: 'blockCardView-content-wrap',
@@ -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 = "114.22.1";
25
25
  var halfFocusRing = 1;
26
26
  var dropOffset = '0, 8';
27
27
  var fadeIn = keyframes({
@@ -79,16 +79,6 @@ export declare const aiSuggestionsMessages: {
79
79
  description: string;
80
80
  id: string;
81
81
  };
82
- fetchGenerateFromAdf: {
83
- defaultMessage: string;
84
- description: string;
85
- id: string;
86
- };
87
- fetchGenerateFromDocument: {
88
- defaultMessage: string;
89
- description: string;
90
- id: string;
91
- };
92
82
  fetchSuggestionsButtonLabel: {
93
83
  defaultMessage: string;
94
84
  description: string;
@@ -79,16 +79,6 @@ export declare const aiSuggestionsMessages: {
79
79
  description: string;
80
80
  id: string;
81
81
  };
82
- fetchGenerateFromAdf: {
83
- defaultMessage: string;
84
- description: string;
85
- id: string;
86
- };
87
- fetchGenerateFromDocument: {
88
- defaultMessage: string;
89
- description: string;
90
- id: string;
91
- };
92
82
  fetchSuggestionsButtonLabel: {
93
83
  defaultMessage: string;
94
84
  description: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "114.22.0",
3
+ "version": "114.23.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/"
@@ -81,7 +81,7 @@
81
81
  "@atlaskit/prosemirror-history": "^0.2.0",
82
82
  "@atlaskit/react-ufo": "^5.19.0",
83
83
  "@atlaskit/section-message": "^8.12.0",
84
- "@atlaskit/smart-card": "^44.7.0",
84
+ "@atlaskit/smart-card": "^44.8.0",
85
85
  "@atlaskit/smart-user-picker": "^10.0.0",
86
86
  "@atlaskit/spinner": "^19.1.0",
87
87
  "@atlaskit/task-decision": "^20.0.0",
@@ -253,6 +253,9 @@
253
253
  "platform_editor_ally_remove_role_tabpanel": {
254
254
  "type": "boolean"
255
255
  },
256
+ "platform_editor_native_anchor_patch_3": {
257
+ "type": "boolean"
258
+ },
256
259
  "platform_editor_toolbar_aifc_placement_overridden": {
257
260
  "type": "boolean"
258
261
  },