@atlaskit/editor-common 107.12.4 → 107.12.6

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.
Files changed (39) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/cjs/extensibility/Extension/Extension/index.js +3 -1
  3. package/dist/cjs/extensibility/Extension/Extension/styles.js +21 -1
  4. package/dist/cjs/hooks/sharedPluginStateHookMigratorFactory.js +2 -2
  5. package/dist/cjs/hooks/usePluginStateEffect.js +2 -2
  6. package/dist/cjs/monitoring/error.js +1 -1
  7. package/dist/cjs/ui/DropList/index.js +1 -1
  8. package/dist/cjs/ui/HoverLinkOverlay/index.js +214 -0
  9. package/dist/cjs/ui/HoverLinkOverlay/types.js +5 -0
  10. package/dist/cjs/ui/index.js +7 -0
  11. package/dist/es2019/extensibility/Extension/Extension/index.js +4 -2
  12. package/dist/es2019/extensibility/Extension/Extension/styles.js +20 -0
  13. package/dist/es2019/hooks/sharedPluginStateHookMigratorFactory.js +2 -2
  14. package/dist/es2019/hooks/usePluginStateEffect.js +2 -2
  15. package/dist/es2019/monitoring/error.js +1 -1
  16. package/dist/es2019/ui/DropList/index.js +1 -1
  17. package/dist/es2019/ui/HoverLinkOverlay/index.js +190 -0
  18. package/dist/es2019/ui/HoverLinkOverlay/types.js +1 -0
  19. package/dist/es2019/ui/index.js +2 -1
  20. package/dist/esm/extensibility/Extension/Extension/index.js +4 -2
  21. package/dist/esm/extensibility/Extension/Extension/styles.js +20 -0
  22. package/dist/esm/hooks/sharedPluginStateHookMigratorFactory.js +2 -2
  23. package/dist/esm/hooks/usePluginStateEffect.js +2 -2
  24. package/dist/esm/monitoring/error.js +1 -1
  25. package/dist/esm/ui/DropList/index.js +1 -1
  26. package/dist/esm/ui/HoverLinkOverlay/index.js +200 -0
  27. package/dist/esm/ui/HoverLinkOverlay/types.js +1 -0
  28. package/dist/esm/ui/index.js +2 -1
  29. package/dist/types/extensibility/Extension/Extension/styles.d.ts +1 -0
  30. package/dist/types/hooks/sharedPluginStateHookMigratorFactory.d.ts +1 -1
  31. package/dist/types/ui/HoverLinkOverlay/index.d.ts +9 -0
  32. package/dist/types/ui/HoverLinkOverlay/types.d.ts +12 -0
  33. package/dist/types/ui/index.d.ts +1 -0
  34. package/dist/types-ts4.5/extensibility/Extension/Extension/styles.d.ts +1 -0
  35. package/dist/types-ts4.5/hooks/sharedPluginStateHookMigratorFactory.d.ts +1 -1
  36. package/dist/types-ts4.5/ui/HoverLinkOverlay/index.d.ts +9 -0
  37. package/dist/types-ts4.5/ui/HoverLinkOverlay/types.d.ts +12 -0
  38. package/dist/types-ts4.5/ui/index.d.ts +1 -0
  39. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 107.12.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [#190588](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/190588)
8
+ [`b22e308cfd320`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b22e308cfd320) -
9
+ Replace experiment key platform_editor_useSharedPluginStateSelector with
10
+ platform_editor_useSharedPluginStateWithSelector
11
+ - [#189832](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/189832)
12
+ [`a3b339a1e6839`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a3b339a1e6839) -
13
+ [ux] ED-28512 Update extension content styles to use box-sizing and removing unused padding to fix
14
+ flickering issue when cards is nested inside extension nodes
15
+ - Updated dependencies
16
+
17
+ ## 107.12.5
18
+
19
+ ### Patch Changes
20
+
21
+ - [#188416](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/188416)
22
+ [`3d0ab988998ae`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3d0ab988998ae) -
23
+ [EDITOR-1067] Adding new actions to plus button in editor new command palette
24
+ - Updated dependencies
25
+
3
26
  ## 107.12.4
4
27
 
5
28
  ### Patch Changes
@@ -13,6 +13,7 @@ var _react = _interopRequireWildcard(require("react"));
13
13
  var _react2 = require("@emotion/react");
14
14
  var _classnames2 = _interopRequireDefault(require("classnames"));
15
15
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
16
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
16
17
  var _hooks = require("../../../hooks");
17
18
  var _ui = require("../../../ui");
18
19
  var _utils = require("../../../utils");
@@ -131,6 +132,7 @@ function ExtensionWithPluginState(props) {
131
132
  setIsNodeHovered(didHover);
132
133
  }
133
134
  };
135
+ var extensionContentStyles = (0, _expValEquals.expValEquals)('platform_editor_extension_styles', 'isEnabled', true) ? _styles2.extensionContent : _styles2.content;
134
136
  return (0, _react2.jsx)(_react.Fragment, null, showLegacyContentHeader && (0, _react2.jsx)(_LegacyContentHeader.LegacyContentHeader, {
135
137
  isNodeSelected: isNodeSelected,
136
138
  isNodeHovered: isNodeHovered,
@@ -209,7 +211,7 @@ function ExtensionWithPluginState(props) {
209
211
  "data-testid": "extension-content"
210
212
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
211
213
  ,
212
- css: _styles2.content
214
+ css: extensionContentStyles
213
215
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
214
216
  ,
215
217
  className: contentClassNames
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.wrapperStyleInheritedCursor = exports.widerLayoutClassName = exports.overflowWrapperStyles = exports.header = exports.contentWrapper = exports.content = void 0;
6
+ exports.wrapperStyleInheritedCursor = exports.widerLayoutClassName = exports.overflowWrapperStyles = exports.header = exports.extensionContent = exports.contentWrapper = exports.content = void 0;
7
7
  var _react = require("@emotion/react");
8
8
  var _styles = require("../styles");
9
9
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
@@ -84,6 +84,26 @@ var content = exports.content = (0, _react.css)({
84
84
  }
85
85
  });
86
86
 
87
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
88
+ var extensionContent = exports.extensionContent = (0, _react.css)({
89
+ boxSizing: 'border-box',
90
+ paddingTop: "var(--ds-space-100, 8px)",
91
+ paddingBottom: "var(--ds-space-100, 8px)",
92
+ background: "var(--ds-surface, white)",
93
+ border: "1px solid ".concat("var(--ds-border, #091E4224)"),
94
+ borderRadius: "var(--ds-border-radius, 3px)",
95
+ cursor: 'initial',
96
+ width: '100%',
97
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
98
+ '&.remove-border': {
99
+ border: 'none'
100
+ },
101
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
102
+ '&.hide-content': {
103
+ display: 'none'
104
+ }
105
+ });
106
+
87
107
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
88
108
  var contentWrapper = exports.contentWrapper = (0, _react.css)({
89
109
  padding: "0 ".concat("var(--ds-space-100, 8px)", " ", "var(--ds-space-100, 8px)"),
@@ -7,7 +7,7 @@ exports.sharedPluginStateHookMigratorFactory = sharedPluginStateHookMigratorFact
7
7
  var _platformFeatureFlagsReact = require("@atlaskit/platform-feature-flags-react");
8
8
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
9
9
  /**
10
- * **Warning: This hook is controlled by the `platform_editor_usesharedpluginstateselector` experiment.**
10
+ * **Warning: This hook is controlled by the `platform_editor_usesharedpluginstatewithselector` experiment.**
11
11
  *
12
12
  * This hook is a migrator for the legacy `useSharedPluginState` hook and will be removed in the future.
13
13
  * Please use `useSharedPluginStateSelector` instead.
@@ -18,6 +18,6 @@ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
18
18
  */
19
19
  function sharedPluginStateHookMigratorFactory(newHook, oldHook) {
20
20
  return (0, _platformFeatureFlagsReact.conditionalHooksFactory)(function () {
21
- return (0, _expValEquals.expValEquals)('platform_editor_usesharedpluginstateselector', 'isEnabled', true);
21
+ return (0, _expValEquals.expValEquals)('platform_editor_usesharedpluginstatewithselector', 'isEnabled', true);
22
22
  }, newHook, oldHook);
23
23
  }
@@ -107,7 +107,7 @@ function usePluginStateEffectInternal(externalPlugins, effect) {
107
107
  // We should store the latest effect in a reference so it is more intuitive to the user
108
108
  // and we are not causing a memory leak by having references to old state.
109
109
  (0, _react.useLayoutEffect)(function () {
110
- if (options.disabled || !(0, _expValEquals.expValEquals)('platform_editor_usesharedpluginstateselector', 'isEnabled', true)) {
110
+ if (options.disabled || !(0, _expValEquals.expValEquals)('platform_editor_usesharedpluginstatewithselector', 'isEnabled', true)) {
111
111
  return;
112
112
  }
113
113
  latestEffect.current = (0, _debounce.default)(effect);
@@ -116,7 +116,7 @@ function usePluginStateEffectInternal(externalPlugins, effect) {
116
116
  };
117
117
  }, [effect, options.disabled]);
118
118
  (0, _react.useEffect)(function () {
119
- if (options.disabled || (0, _expValEquals.expValEquals)('platform_editor_usesharedpluginstateselector', 'isEnabled', true)) {
119
+ if (options.disabled || (0, _expValEquals.expValEquals)('platform_editor_usesharedpluginstatewithselector', 'isEnabled', true)) {
120
120
  return;
121
121
  }
122
122
  latestEffect.current = (0, _debounce.default)(effect);
@@ -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.12.3";
19
+ var packageVersion = "107.12.5";
20
20
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
21
21
  // Remove URL as it has UGC
22
22
  // 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 = "107.12.3";
26
+ var packageVersion = "107.12.5";
27
27
  var halfFocusRing = 1;
28
28
  var dropOffset = '0, 8';
29
29
  // Ignored via go/ees005
@@ -0,0 +1,214 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
+ var _react = _interopRequireWildcard(require("react"));
11
+ var _react2 = require("@emotion/react");
12
+ var _reactIntlNext = require("react-intl-next");
13
+ var _state = require("@atlaskit/editor-prosemirror/state");
14
+ var _linkExternal = _interopRequireDefault(require("@atlaskit/icon/core/link-external"));
15
+ var _panelRight = _interopRequireDefault(require("@atlaskit/icon/core/panel-right"));
16
+ var _primitives = require("@atlaskit/primitives");
17
+ var _analytics = require("../../analytics");
18
+ var _messages = require("../../messages");
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
+ /* eslint-disable @atlaskit/design-system/no-nested-styles */
21
+ /* eslint-disable @atlaskit/design-system/prefer-primitives */
22
+ /**
23
+ * @jsxRuntime classic
24
+ * @jsx jsx
25
+ */
26
+
27
+ // eslint-disable-line @atlaskit/ui-styling-standard/use-compiled
28
+
29
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
30
+
31
+ // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
32
+
33
+ var containerStyles = (0, _react2.css)({
34
+ position: 'relative'
35
+ });
36
+ var iconWrapperStyles = (0, _primitives.xcss)({
37
+ display: 'inline-flex',
38
+ justifyContent: 'center',
39
+ alignItems: 'center',
40
+ height: '17px',
41
+ width: '17px'
42
+ });
43
+ var hiddenTextStyle = (0, _react2.css)({
44
+ overflow: 'hidden',
45
+ whiteSpace: 'nowrap',
46
+ position: 'absolute',
47
+ visibility: 'hidden'
48
+ });
49
+ var linkStyles = (0, _primitives.xcss)({
50
+ position: 'absolute',
51
+ left: 'space.025',
52
+ top: '-1px',
53
+ display: 'inline-flex',
54
+ alignItems: 'center',
55
+ verticalAlign: 'middle',
56
+ paddingBlock: 'space.025',
57
+ paddingInline: 'space.050',
58
+ gap: 'space.025',
59
+ overflow: 'hidden',
60
+ zIndex: 'card',
61
+ backgroundColor: 'color.background.accent.gray.subtlest',
62
+ borderRadius: "var(--ds-border-radius, 3px)",
63
+ color: 'color.text.subtle',
64
+ textDecoration: 'none',
65
+ whiteSpace: 'nowrap',
66
+ ':hover': {
67
+ backgroundColor: 'elevation.surface.hovered',
68
+ color: 'color.text.subtle',
69
+ textDecoration: 'none'
70
+ }
71
+ });
72
+ var MIN_AVAILABLE_SPACE_WITH_LABEL_OVERLAY = 45;
73
+ var ICON_WIDTH = 16;
74
+ var DEFAULT_OPEN_TEXT_WIDTH = 28; // Default open text width in English
75
+
76
+ var visitCardLinkAnalytics = function visitCardLinkAnalytics(editorAnalyticsApi, inputMethod) {
77
+ return function (state, dispatch) {
78
+ if (!(state.selection instanceof _state.NodeSelection)) {
79
+ return false;
80
+ }
81
+ var type = state.selection.node.type;
82
+ if (dispatch) {
83
+ var tr = state.tr;
84
+ editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent((0, _analytics.buildVisitedNonHyperLinkPayload)(type.name, inputMethod))(tr);
85
+ dispatch(tr);
86
+ }
87
+ return true;
88
+ };
89
+ };
90
+ var HoverLinkOverlay = function HoverLinkOverlay(_ref) {
91
+ var children = _ref.children,
92
+ _ref$isVisible = _ref.isVisible,
93
+ isVisible = _ref$isVisible === void 0 ? false : _ref$isVisible,
94
+ url = _ref.url,
95
+ _ref$compactPadding = _ref.compactPadding,
96
+ compactPadding = _ref$compactPadding === void 0 ? false : _ref$compactPadding,
97
+ editorAnalyticsApi = _ref.editorAnalyticsApi,
98
+ view = _ref.view,
99
+ onClick = _ref.onClick,
100
+ _ref$showPanelButton = _ref.showPanelButton,
101
+ showPanelButton = _ref$showPanelButton === void 0 ? false : _ref$showPanelButton;
102
+ var _useIntl = (0, _reactIntlNext.useIntl)(),
103
+ formatMessage = _useIntl.formatMessage;
104
+ var label = showPanelButton ? formatMessage(_messages.cardMessages.panelButtonTitle) : formatMessage(_messages.cardMessages.openButtonTitle);
105
+ var containerRef = (0, _react.useRef)(null);
106
+ var hoverLinkButtonRef = (0, _react.useRef)(null);
107
+ var hiddenTextRef = (0, _react.useRef)(null);
108
+ var _useState = (0, _react.useState)(true),
109
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
110
+ showLabel = _useState2[0],
111
+ setShowLabel = _useState2[1];
112
+ var _useState3 = (0, _react.useState)(false),
113
+ _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
114
+ isHovered = _useState4[0],
115
+ setHovered = _useState4[1];
116
+ var openTextWidthRef = (0, _react.useRef)(null);
117
+ (0, _react.useLayoutEffect)(function () {
118
+ var _containerRef$current, _hoverLinkButtonRef$c;
119
+ if (!isVisible || !isHovered) {
120
+ return;
121
+ }
122
+ var cardWidth = (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.offsetWidth;
123
+ var openButtonWidth = (_hoverLinkButtonRef$c = hoverLinkButtonRef.current) === null || _hoverLinkButtonRef$c === void 0 ? void 0 : _hoverLinkButtonRef$c.offsetWidth;
124
+
125
+ // Get the hidden text width
126
+ if (!openTextWidthRef.current) {
127
+ var hiddenText = hiddenTextRef.current;
128
+ if (hiddenText) {
129
+ // Measure the width of the hidden text
130
+ // Temporarily make the element visible to measure its width
131
+ hiddenText.style.visibility = 'hidden';
132
+ hiddenText.style.display = 'inline';
133
+ openTextWidthRef.current = hiddenText.offsetWidth;
134
+
135
+ // Reset the hiddenText's display property
136
+ hiddenText.style.display = 'none';
137
+ hiddenText.style.visibility = 'inherit';
138
+ } else {
139
+ openTextWidthRef.current = DEFAULT_OPEN_TEXT_WIDTH;
140
+ }
141
+ }
142
+ if (!cardWidth || !openButtonWidth) {
143
+ return;
144
+ }
145
+ var openTextWidth = openTextWidthRef.current || DEFAULT_OPEN_TEXT_WIDTH;
146
+ var canShowLabel = cardWidth - openTextWidth > MIN_AVAILABLE_SPACE_WITH_LABEL_OVERLAY + ICON_WIDTH;
147
+ setShowLabel(canShowLabel);
148
+ }, [isVisible, isHovered]);
149
+ var handleOverlayChange = function handleOverlayChange(isHovered) {
150
+ setHovered(isHovered);
151
+ };
152
+ var sendVisitLinkAnalytics = function sendVisitLinkAnalytics(inputMethod) {
153
+ if (editorAnalyticsApi && view) {
154
+ visitCardLinkAnalytics(editorAnalyticsApi, inputMethod)(view.state, view.dispatch);
155
+ }
156
+ };
157
+ var handleDoubleClick = function handleDoubleClick() {
158
+ if (!showPanelButton) {
159
+ sendVisitLinkAnalytics(_analytics.INPUT_METHOD.DOUBLE_CLICK);
160
+
161
+ // Double click opens the link in a new tab
162
+ window.open(url, '_blank');
163
+ }
164
+ };
165
+ var handleClick = function handleClick(event) {
166
+ if (showPanelButton && onClick) {
167
+ onClick(event);
168
+ } else {
169
+ sendVisitLinkAnalytics(_analytics.INPUT_METHOD.BUTTON);
170
+ }
171
+ };
172
+ return (
173
+ // eslint-disable-next-line jsx-a11y/no-static-element-interactions
174
+ (0, _react2.jsx)("span", {
175
+ ref: containerRef,
176
+ css: containerStyles,
177
+ onDoubleClick: handleDoubleClick,
178
+ onMouseEnter: function onMouseEnter() {
179
+ return handleOverlayChange(true);
180
+ },
181
+ onMouseLeave: function onMouseLeave() {
182
+ return handleOverlayChange(false);
183
+ }
184
+ }, children, (0, _react2.jsx)("span", {
185
+ css: hiddenTextStyle,
186
+ "aria-hidden": "true"
187
+ }, (0, _react2.jsx)(_primitives.Text, {
188
+ ref: hiddenTextRef,
189
+ size: "small",
190
+ maxLines: 1
191
+ }, label)), isHovered && (0, _react2.jsx)(_primitives.Anchor, {
192
+ ref: hoverLinkButtonRef,
193
+ xcss: linkStyles,
194
+ href: url,
195
+ target: "_blank",
196
+ style: {
197
+ paddingBlock: compactPadding ? '1px' : "var(--ds-space-025, 2px)"
198
+ },
199
+ onClick: handleClick
200
+ }, (0, _react2.jsx)(_primitives.Box, {
201
+ xcss: iconWrapperStyles,
202
+ "data-inlinecard-button-overlay": "icon-wrapper-line-height"
203
+ }, showPanelButton ? (0, _react2.jsx)(_panelRight.default, {
204
+ label: ""
205
+ }) : (0, _react2.jsx)(_linkExternal.default, {
206
+ label: ""
207
+ })), showLabel && (0, _react2.jsx)(_primitives.Text, {
208
+ size: "small",
209
+ color: "color.text.subtle",
210
+ maxLines: 1
211
+ }, label)))
212
+ );
213
+ };
214
+ var _default = exports.default = HoverLinkOverlay;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -101,6 +101,12 @@ Object.defineProperty(exports, "HelperMessage", {
101
101
  return _Messages.HelperMessage;
102
102
  }
103
103
  });
104
+ Object.defineProperty(exports, "HoverLinkOverlay", {
105
+ enumerable: true,
106
+ get: function get() {
107
+ return _HoverLinkOverlay.default;
108
+ }
109
+ });
104
110
  Object.defineProperty(exports, "IntlErrorBoundary", {
105
111
  enumerable: true,
106
112
  get: function get() {
@@ -492,4 +498,5 @@ var _Separator2 = require("./Toolbar/Separator");
492
498
  var _DropList = _interopRequireDefault(require("./DropList"));
493
499
  var _MultiBodiedExtension = require("./MultiBodiedExtension");
494
500
  var _TableSelector = _interopRequireDefault(require("./TableSelector"));
501
+ var _HoverLinkOverlay = _interopRequireDefault(require("./HoverLinkOverlay"));
495
502
  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); }
@@ -10,6 +10,7 @@ import React, { Fragment } from 'react';
10
10
  import { jsx } from '@emotion/react';
11
11
  import classnames from 'classnames';
12
12
  import { fg } from '@atlaskit/platform-feature-flags';
13
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
13
14
  import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '../../../hooks';
14
15
  import { overflowShadow } from '../../../ui';
15
16
  import { calculateBreakoutStyles } from '../../../utils';
@@ -17,7 +18,7 @@ import { LegacyContentHeader } from '../LegacyContentHeader';
17
18
  import ExtensionLozenge from '../Lozenge';
18
19
  import { overlay } from '../styles';
19
20
  import { isEmptyBodiedMacro } from './extension-utils';
20
- import { content, contentWrapper, header, overflowWrapperStyles, widerLayoutClassName, wrapperStyleInheritedCursor } from './styles';
21
+ import { content, extensionContent, contentWrapper, header, overflowWrapperStyles, widerLayoutClassName, wrapperStyleInheritedCursor } from './styles';
21
22
  function ExtensionWithPluginState(props) {
22
23
  var _node$attrs, _node$attrs$parameter, _node$attrs$parameter2, _node$attrs$parameter3;
23
24
  const {
@@ -131,6 +132,7 @@ function ExtensionWithPluginState(props) {
131
132
  setIsNodeHovered(didHover);
132
133
  }
133
134
  };
135
+ const extensionContentStyles = expValEquals('platform_editor_extension_styles', 'isEnabled', true) ? extensionContent : content;
134
136
  return jsx(Fragment, null, showLegacyContentHeader && jsx(LegacyContentHeader, {
135
137
  isNodeSelected: isNodeSelected,
136
138
  isNodeHovered: isNodeHovered,
@@ -201,7 +203,7 @@ function ExtensionWithPluginState(props) {
201
203
  "data-testid": "extension-content"
202
204
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
203
205
  ,
204
- css: content
206
+ css: extensionContentStyles
205
207
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
206
208
  ,
207
209
  className: contentClassNames
@@ -77,6 +77,26 @@ export const content = css({
77
77
  }
78
78
  });
79
79
 
80
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
81
+ export const extensionContent = css({
82
+ boxSizing: 'border-box',
83
+ paddingTop: "var(--ds-space-100, 8px)",
84
+ paddingBottom: "var(--ds-space-100, 8px)",
85
+ background: "var(--ds-surface, white)",
86
+ border: `1px solid ${"var(--ds-border, #091E4224)"}`,
87
+ borderRadius: "var(--ds-border-radius, 3px)",
88
+ cursor: 'initial',
89
+ width: '100%',
90
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
91
+ '&.remove-border': {
92
+ border: 'none'
93
+ },
94
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
95
+ '&.hide-content': {
96
+ display: 'none'
97
+ }
98
+ });
99
+
80
100
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
81
101
  export const contentWrapper = css({
82
102
  padding: `0 ${"var(--ds-space-100, 8px)"} ${"var(--ds-space-100, 8px)"}`,
@@ -2,7 +2,7 @@ import { conditionalHooksFactory } from '@atlaskit/platform-feature-flags-react'
2
2
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
3
3
 
4
4
  /**
5
- * **Warning: This hook is controlled by the `platform_editor_usesharedpluginstateselector` experiment.**
5
+ * **Warning: This hook is controlled by the `platform_editor_usesharedpluginstatewithselector` experiment.**
6
6
  *
7
7
  * This hook is a migrator for the legacy `useSharedPluginState` hook and will be removed in the future.
8
8
  * Please use `useSharedPluginStateSelector` instead.
@@ -12,5 +12,5 @@ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
12
12
  * @returns
13
13
  */
14
14
  export function sharedPluginStateHookMigratorFactory(newHook, oldHook) {
15
- return conditionalHooksFactory(() => expValEquals('platform_editor_usesharedpluginstateselector', 'isEnabled', true), newHook, oldHook);
15
+ return conditionalHooksFactory(() => expValEquals('platform_editor_usesharedpluginstatewithselector', 'isEnabled', true), newHook, oldHook);
16
16
  }
@@ -90,7 +90,7 @@ function usePluginStateEffectInternal(externalPlugins, effect, options = {}) {
90
90
  // We should store the latest effect in a reference so it is more intuitive to the user
91
91
  // and we are not causing a memory leak by having references to old state.
92
92
  useLayoutEffect(() => {
93
- if (options.disabled || !expValEquals('platform_editor_usesharedpluginstateselector', 'isEnabled', true)) {
93
+ if (options.disabled || !expValEquals('platform_editor_usesharedpluginstatewithselector', 'isEnabled', true)) {
94
94
  return;
95
95
  }
96
96
  latestEffect.current = debounce(effect);
@@ -99,7 +99,7 @@ function usePluginStateEffectInternal(externalPlugins, effect, options = {}) {
99
99
  };
100
100
  }, [effect, options.disabled]);
101
101
  useEffect(() => {
102
- if (options.disabled || expValEquals('platform_editor_usesharedpluginstateselector', 'isEnabled', true)) {
102
+ if (options.disabled || expValEquals('platform_editor_usesharedpluginstatewithselector', 'isEnabled', true)) {
103
103
  return;
104
104
  }
105
105
  latestEffect.current = debounce(effect);
@@ -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.12.3";
4
+ const packageVersion = "107.12.5";
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 = "107.12.3";
16
+ const packageVersion = "107.12.5";
17
17
  const halfFocusRing = 1;
18
18
  const dropOffset = '0, 8';
19
19
  // Ignored via go/ees005
@@ -0,0 +1,190 @@
1
+ /* eslint-disable @atlaskit/design-system/no-nested-styles */
2
+ /* eslint-disable @atlaskit/design-system/prefer-primitives */
3
+ /**
4
+ * @jsxRuntime classic
5
+ * @jsx jsx
6
+ */
7
+ import React, { useLayoutEffect, useRef, useState } from 'react';
8
+ import { css, jsx } from '@emotion/react'; // eslint-disable-line @atlaskit/ui-styling-standard/use-compiled
9
+ import { useIntl } from 'react-intl-next';
10
+ import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
11
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
12
+ import LinkExternalIcon from '@atlaskit/icon/core/link-external';
13
+ import PanelRightIcon from '@atlaskit/icon/core/panel-right';
14
+ // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
15
+ import { Anchor, Box, Text, xcss } from '@atlaskit/primitives';
16
+ import { buildVisitedNonHyperLinkPayload, INPUT_METHOD } from '../../analytics';
17
+ import { cardMessages } from '../../messages';
18
+ const containerStyles = css({
19
+ position: 'relative'
20
+ });
21
+ const iconWrapperStyles = xcss({
22
+ display: 'inline-flex',
23
+ justifyContent: 'center',
24
+ alignItems: 'center',
25
+ height: '17px',
26
+ width: '17px'
27
+ });
28
+ const hiddenTextStyle = css({
29
+ overflow: 'hidden',
30
+ whiteSpace: 'nowrap',
31
+ position: 'absolute',
32
+ visibility: 'hidden'
33
+ });
34
+ const linkStyles = xcss({
35
+ position: 'absolute',
36
+ left: 'space.025',
37
+ top: '-1px',
38
+ display: 'inline-flex',
39
+ alignItems: 'center',
40
+ verticalAlign: 'middle',
41
+ paddingBlock: 'space.025',
42
+ paddingInline: 'space.050',
43
+ gap: 'space.025',
44
+ overflow: 'hidden',
45
+ zIndex: 'card',
46
+ backgroundColor: 'color.background.accent.gray.subtlest',
47
+ borderRadius: "var(--ds-border-radius, 3px)",
48
+ color: 'color.text.subtle',
49
+ textDecoration: 'none',
50
+ whiteSpace: 'nowrap',
51
+ ':hover': {
52
+ backgroundColor: 'elevation.surface.hovered',
53
+ color: 'color.text.subtle',
54
+ textDecoration: 'none'
55
+ }
56
+ });
57
+ const MIN_AVAILABLE_SPACE_WITH_LABEL_OVERLAY = 45;
58
+ const ICON_WIDTH = 16;
59
+ const DEFAULT_OPEN_TEXT_WIDTH = 28; // Default open text width in English
60
+
61
+ const visitCardLinkAnalytics = (editorAnalyticsApi, inputMethod) => (state, dispatch) => {
62
+ if (!(state.selection instanceof NodeSelection)) {
63
+ return false;
64
+ }
65
+ const {
66
+ type
67
+ } = state.selection.node;
68
+ if (dispatch) {
69
+ const {
70
+ tr
71
+ } = state;
72
+ editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent(buildVisitedNonHyperLinkPayload(type.name, inputMethod))(tr);
73
+ dispatch(tr);
74
+ }
75
+ return true;
76
+ };
77
+ const HoverLinkOverlay = ({
78
+ children,
79
+ isVisible = false,
80
+ url,
81
+ compactPadding = false,
82
+ editorAnalyticsApi,
83
+ view,
84
+ onClick,
85
+ showPanelButton = false
86
+ }) => {
87
+ const {
88
+ formatMessage
89
+ } = useIntl();
90
+ const label = showPanelButton ? formatMessage(cardMessages.panelButtonTitle) : formatMessage(cardMessages.openButtonTitle);
91
+ const containerRef = useRef(null);
92
+ const hoverLinkButtonRef = useRef(null);
93
+ const hiddenTextRef = useRef(null);
94
+ const [showLabel, setShowLabel] = useState(true);
95
+ const [isHovered, setHovered] = useState(false);
96
+ const openTextWidthRef = useRef(null);
97
+ useLayoutEffect(() => {
98
+ var _containerRef$current, _hoverLinkButtonRef$c;
99
+ if (!isVisible || !isHovered) {
100
+ return;
101
+ }
102
+ const cardWidth = (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.offsetWidth;
103
+ const openButtonWidth = (_hoverLinkButtonRef$c = hoverLinkButtonRef.current) === null || _hoverLinkButtonRef$c === void 0 ? void 0 : _hoverLinkButtonRef$c.offsetWidth;
104
+
105
+ // Get the hidden text width
106
+ if (!openTextWidthRef.current) {
107
+ const hiddenText = hiddenTextRef.current;
108
+ if (hiddenText) {
109
+ // Measure the width of the hidden text
110
+ // Temporarily make the element visible to measure its width
111
+ hiddenText.style.visibility = 'hidden';
112
+ hiddenText.style.display = 'inline';
113
+ openTextWidthRef.current = hiddenText.offsetWidth;
114
+
115
+ // Reset the hiddenText's display property
116
+ hiddenText.style.display = 'none';
117
+ hiddenText.style.visibility = 'inherit';
118
+ } else {
119
+ openTextWidthRef.current = DEFAULT_OPEN_TEXT_WIDTH;
120
+ }
121
+ }
122
+ if (!cardWidth || !openButtonWidth) {
123
+ return;
124
+ }
125
+ const openTextWidth = openTextWidthRef.current || DEFAULT_OPEN_TEXT_WIDTH;
126
+ const canShowLabel = cardWidth - openTextWidth > MIN_AVAILABLE_SPACE_WITH_LABEL_OVERLAY + ICON_WIDTH;
127
+ setShowLabel(canShowLabel);
128
+ }, [isVisible, isHovered]);
129
+ const handleOverlayChange = isHovered => {
130
+ setHovered(isHovered);
131
+ };
132
+ const sendVisitLinkAnalytics = inputMethod => {
133
+ if (editorAnalyticsApi && view) {
134
+ visitCardLinkAnalytics(editorAnalyticsApi, inputMethod)(view.state, view.dispatch);
135
+ }
136
+ };
137
+ const handleDoubleClick = () => {
138
+ if (!showPanelButton) {
139
+ sendVisitLinkAnalytics(INPUT_METHOD.DOUBLE_CLICK);
140
+
141
+ // Double click opens the link in a new tab
142
+ window.open(url, '_blank');
143
+ }
144
+ };
145
+ const handleClick = event => {
146
+ if (showPanelButton && onClick) {
147
+ onClick(event);
148
+ } else {
149
+ sendVisitLinkAnalytics(INPUT_METHOD.BUTTON);
150
+ }
151
+ };
152
+ return (
153
+ // eslint-disable-next-line jsx-a11y/no-static-element-interactions
154
+ jsx("span", {
155
+ ref: containerRef,
156
+ css: containerStyles,
157
+ onDoubleClick: handleDoubleClick,
158
+ onMouseEnter: () => handleOverlayChange(true),
159
+ onMouseLeave: () => handleOverlayChange(false)
160
+ }, children, jsx("span", {
161
+ css: hiddenTextStyle,
162
+ "aria-hidden": "true"
163
+ }, jsx(Text, {
164
+ ref: hiddenTextRef,
165
+ size: "small",
166
+ maxLines: 1
167
+ }, label)), isHovered && jsx(Anchor, {
168
+ ref: hoverLinkButtonRef,
169
+ xcss: linkStyles,
170
+ href: url,
171
+ target: "_blank",
172
+ style: {
173
+ paddingBlock: compactPadding ? '1px' : "var(--ds-space-025, 2px)"
174
+ },
175
+ onClick: handleClick
176
+ }, jsx(Box, {
177
+ xcss: iconWrapperStyles,
178
+ "data-inlinecard-button-overlay": "icon-wrapper-line-height"
179
+ }, showPanelButton ? jsx(PanelRightIcon, {
180
+ label: ""
181
+ }) : jsx(LinkExternalIcon, {
182
+ label: ""
183
+ })), showLabel && jsx(Text, {
184
+ size: "small",
185
+ color: "color.text.subtle",
186
+ maxLines: 1
187
+ }, label)))
188
+ );
189
+ };
190
+ export default HoverLinkOverlay;
@@ -0,0 +1 @@
1
+ export {};
@@ -43,4 +43,5 @@ export { ToolbarExpandIcon } from './Toolbar/ExpandIcon';
43
43
  export { ToolbarSeparator } from './Toolbar/Separator';
44
44
  export { default as DropList } from './DropList';
45
45
  export { sharedMultiBodiedExtensionStyles } from './MultiBodiedExtension';
46
- export { default as TableSelectorPopup } from './TableSelector';
46
+ export { default as TableSelectorPopup } from './TableSelector';
47
+ export { default as HoverLinkOverlay } from './HoverLinkOverlay';
@@ -15,6 +15,7 @@ import React, { Fragment } from 'react';
15
15
  import { jsx } from '@emotion/react';
16
16
  import classnames from 'classnames';
17
17
  import { fg } from '@atlaskit/platform-feature-flags';
18
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
18
19
  import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '../../../hooks';
19
20
  import { overflowShadow } from '../../../ui';
20
21
  import { calculateBreakoutStyles } from '../../../utils';
@@ -22,7 +23,7 @@ import { LegacyContentHeader } from '../LegacyContentHeader';
22
23
  import ExtensionLozenge from '../Lozenge';
23
24
  import { overlay } from '../styles';
24
25
  import { isEmptyBodiedMacro } from './extension-utils';
25
- import { content, contentWrapper, header, overflowWrapperStyles, widerLayoutClassName, wrapperStyleInheritedCursor } from './styles';
26
+ import { content, extensionContent, contentWrapper, header, overflowWrapperStyles, widerLayoutClassName, wrapperStyleInheritedCursor } from './styles';
26
27
  function ExtensionWithPluginState(props) {
27
28
  var _node$attrs;
28
29
  var node = props.node,
@@ -124,6 +125,7 @@ function ExtensionWithPluginState(props) {
124
125
  setIsNodeHovered(didHover);
125
126
  }
126
127
  };
128
+ var extensionContentStyles = expValEquals('platform_editor_extension_styles', 'isEnabled', true) ? extensionContent : content;
127
129
  return jsx(Fragment, null, showLegacyContentHeader && jsx(LegacyContentHeader, {
128
130
  isNodeSelected: isNodeSelected,
129
131
  isNodeHovered: isNodeHovered,
@@ -202,7 +204,7 @@ function ExtensionWithPluginState(props) {
202
204
  "data-testid": "extension-content"
203
205
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
204
206
  ,
205
- css: content
207
+ css: extensionContentStyles
206
208
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
207
209
  ,
208
210
  className: contentClassNames
@@ -77,6 +77,26 @@ export var content = css({
77
77
  }
78
78
  });
79
79
 
80
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
81
+ export var extensionContent = css({
82
+ boxSizing: 'border-box',
83
+ paddingTop: "var(--ds-space-100, 8px)",
84
+ paddingBottom: "var(--ds-space-100, 8px)",
85
+ background: "var(--ds-surface, white)",
86
+ border: "1px solid ".concat("var(--ds-border, #091E4224)"),
87
+ borderRadius: "var(--ds-border-radius, 3px)",
88
+ cursor: 'initial',
89
+ width: '100%',
90
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
91
+ '&.remove-border': {
92
+ border: 'none'
93
+ },
94
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
95
+ '&.hide-content': {
96
+ display: 'none'
97
+ }
98
+ });
99
+
80
100
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
81
101
  export var contentWrapper = css({
82
102
  padding: "0 ".concat("var(--ds-space-100, 8px)", " ", "var(--ds-space-100, 8px)"),
@@ -2,7 +2,7 @@ import { conditionalHooksFactory } from '@atlaskit/platform-feature-flags-react'
2
2
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
3
3
 
4
4
  /**
5
- * **Warning: This hook is controlled by the `platform_editor_usesharedpluginstateselector` experiment.**
5
+ * **Warning: This hook is controlled by the `platform_editor_usesharedpluginstatewithselector` experiment.**
6
6
  *
7
7
  * This hook is a migrator for the legacy `useSharedPluginState` hook and will be removed in the future.
8
8
  * Please use `useSharedPluginStateSelector` instead.
@@ -13,6 +13,6 @@ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
13
13
  */
14
14
  export function sharedPluginStateHookMigratorFactory(newHook, oldHook) {
15
15
  return conditionalHooksFactory(function () {
16
- return expValEquals('platform_editor_usesharedpluginstateselector', 'isEnabled', true);
16
+ return expValEquals('platform_editor_usesharedpluginstatewithselector', 'isEnabled', true);
17
17
  }, newHook, oldHook);
18
18
  }
@@ -101,7 +101,7 @@ function usePluginStateEffectInternal(externalPlugins, effect) {
101
101
  // We should store the latest effect in a reference so it is more intuitive to the user
102
102
  // and we are not causing a memory leak by having references to old state.
103
103
  useLayoutEffect(function () {
104
- if (options.disabled || !expValEquals('platform_editor_usesharedpluginstateselector', 'isEnabled', true)) {
104
+ if (options.disabled || !expValEquals('platform_editor_usesharedpluginstatewithselector', 'isEnabled', true)) {
105
105
  return;
106
106
  }
107
107
  latestEffect.current = debounce(effect);
@@ -110,7 +110,7 @@ function usePluginStateEffectInternal(externalPlugins, effect) {
110
110
  };
111
111
  }, [effect, options.disabled]);
112
112
  useEffect(function () {
113
- if (options.disabled || expValEquals('platform_editor_usesharedpluginstateselector', 'isEnabled', true)) {
113
+ if (options.disabled || expValEquals('platform_editor_usesharedpluginstatewithselector', 'isEnabled', true)) {
114
114
  return;
115
115
  }
116
116
  latestEffect.current = debounce(effect);
@@ -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.12.3";
10
+ var packageVersion = "107.12.5";
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 = "107.12.3";
23
+ var packageVersion = "107.12.5";
24
24
  var halfFocusRing = 1;
25
25
  var dropOffset = '0, 8';
26
26
  // Ignored via go/ees005
@@ -0,0 +1,200 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ /* eslint-disable @atlaskit/design-system/no-nested-styles */
3
+ /* eslint-disable @atlaskit/design-system/prefer-primitives */
4
+ /**
5
+ * @jsxRuntime classic
6
+ * @jsx jsx
7
+ */
8
+ import React, { useLayoutEffect, useRef, useState } from 'react';
9
+ import { css, jsx } from '@emotion/react'; // eslint-disable-line @atlaskit/ui-styling-standard/use-compiled
10
+ import { useIntl } from 'react-intl-next';
11
+ import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
12
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
13
+ import LinkExternalIcon from '@atlaskit/icon/core/link-external';
14
+ import PanelRightIcon from '@atlaskit/icon/core/panel-right';
15
+ // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
16
+ import { Anchor, Box, Text, xcss } from '@atlaskit/primitives';
17
+ import { buildVisitedNonHyperLinkPayload, INPUT_METHOD } from '../../analytics';
18
+ import { cardMessages } from '../../messages';
19
+ var containerStyles = css({
20
+ position: 'relative'
21
+ });
22
+ var iconWrapperStyles = xcss({
23
+ display: 'inline-flex',
24
+ justifyContent: 'center',
25
+ alignItems: 'center',
26
+ height: '17px',
27
+ width: '17px'
28
+ });
29
+ var hiddenTextStyle = css({
30
+ overflow: 'hidden',
31
+ whiteSpace: 'nowrap',
32
+ position: 'absolute',
33
+ visibility: 'hidden'
34
+ });
35
+ var linkStyles = xcss({
36
+ position: 'absolute',
37
+ left: 'space.025',
38
+ top: '-1px',
39
+ display: 'inline-flex',
40
+ alignItems: 'center',
41
+ verticalAlign: 'middle',
42
+ paddingBlock: 'space.025',
43
+ paddingInline: 'space.050',
44
+ gap: 'space.025',
45
+ overflow: 'hidden',
46
+ zIndex: 'card',
47
+ backgroundColor: 'color.background.accent.gray.subtlest',
48
+ borderRadius: "var(--ds-border-radius, 3px)",
49
+ color: 'color.text.subtle',
50
+ textDecoration: 'none',
51
+ whiteSpace: 'nowrap',
52
+ ':hover': {
53
+ backgroundColor: 'elevation.surface.hovered',
54
+ color: 'color.text.subtle',
55
+ textDecoration: 'none'
56
+ }
57
+ });
58
+ var MIN_AVAILABLE_SPACE_WITH_LABEL_OVERLAY = 45;
59
+ var ICON_WIDTH = 16;
60
+ var DEFAULT_OPEN_TEXT_WIDTH = 28; // Default open text width in English
61
+
62
+ var visitCardLinkAnalytics = function visitCardLinkAnalytics(editorAnalyticsApi, inputMethod) {
63
+ return function (state, dispatch) {
64
+ if (!(state.selection instanceof NodeSelection)) {
65
+ return false;
66
+ }
67
+ var type = state.selection.node.type;
68
+ if (dispatch) {
69
+ var tr = state.tr;
70
+ editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent(buildVisitedNonHyperLinkPayload(type.name, inputMethod))(tr);
71
+ dispatch(tr);
72
+ }
73
+ return true;
74
+ };
75
+ };
76
+ var HoverLinkOverlay = function HoverLinkOverlay(_ref) {
77
+ var children = _ref.children,
78
+ _ref$isVisible = _ref.isVisible,
79
+ isVisible = _ref$isVisible === void 0 ? false : _ref$isVisible,
80
+ url = _ref.url,
81
+ _ref$compactPadding = _ref.compactPadding,
82
+ compactPadding = _ref$compactPadding === void 0 ? false : _ref$compactPadding,
83
+ editorAnalyticsApi = _ref.editorAnalyticsApi,
84
+ view = _ref.view,
85
+ onClick = _ref.onClick,
86
+ _ref$showPanelButton = _ref.showPanelButton,
87
+ showPanelButton = _ref$showPanelButton === void 0 ? false : _ref$showPanelButton;
88
+ var _useIntl = useIntl(),
89
+ formatMessage = _useIntl.formatMessage;
90
+ var label = showPanelButton ? formatMessage(cardMessages.panelButtonTitle) : formatMessage(cardMessages.openButtonTitle);
91
+ var containerRef = useRef(null);
92
+ var hoverLinkButtonRef = useRef(null);
93
+ var hiddenTextRef = useRef(null);
94
+ var _useState = useState(true),
95
+ _useState2 = _slicedToArray(_useState, 2),
96
+ showLabel = _useState2[0],
97
+ setShowLabel = _useState2[1];
98
+ var _useState3 = useState(false),
99
+ _useState4 = _slicedToArray(_useState3, 2),
100
+ isHovered = _useState4[0],
101
+ setHovered = _useState4[1];
102
+ var openTextWidthRef = useRef(null);
103
+ useLayoutEffect(function () {
104
+ var _containerRef$current, _hoverLinkButtonRef$c;
105
+ if (!isVisible || !isHovered) {
106
+ return;
107
+ }
108
+ var cardWidth = (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.offsetWidth;
109
+ var openButtonWidth = (_hoverLinkButtonRef$c = hoverLinkButtonRef.current) === null || _hoverLinkButtonRef$c === void 0 ? void 0 : _hoverLinkButtonRef$c.offsetWidth;
110
+
111
+ // Get the hidden text width
112
+ if (!openTextWidthRef.current) {
113
+ var hiddenText = hiddenTextRef.current;
114
+ if (hiddenText) {
115
+ // Measure the width of the hidden text
116
+ // Temporarily make the element visible to measure its width
117
+ hiddenText.style.visibility = 'hidden';
118
+ hiddenText.style.display = 'inline';
119
+ openTextWidthRef.current = hiddenText.offsetWidth;
120
+
121
+ // Reset the hiddenText's display property
122
+ hiddenText.style.display = 'none';
123
+ hiddenText.style.visibility = 'inherit';
124
+ } else {
125
+ openTextWidthRef.current = DEFAULT_OPEN_TEXT_WIDTH;
126
+ }
127
+ }
128
+ if (!cardWidth || !openButtonWidth) {
129
+ return;
130
+ }
131
+ var openTextWidth = openTextWidthRef.current || DEFAULT_OPEN_TEXT_WIDTH;
132
+ var canShowLabel = cardWidth - openTextWidth > MIN_AVAILABLE_SPACE_WITH_LABEL_OVERLAY + ICON_WIDTH;
133
+ setShowLabel(canShowLabel);
134
+ }, [isVisible, isHovered]);
135
+ var handleOverlayChange = function handleOverlayChange(isHovered) {
136
+ setHovered(isHovered);
137
+ };
138
+ var sendVisitLinkAnalytics = function sendVisitLinkAnalytics(inputMethod) {
139
+ if (editorAnalyticsApi && view) {
140
+ visitCardLinkAnalytics(editorAnalyticsApi, inputMethod)(view.state, view.dispatch);
141
+ }
142
+ };
143
+ var handleDoubleClick = function handleDoubleClick() {
144
+ if (!showPanelButton) {
145
+ sendVisitLinkAnalytics(INPUT_METHOD.DOUBLE_CLICK);
146
+
147
+ // Double click opens the link in a new tab
148
+ window.open(url, '_blank');
149
+ }
150
+ };
151
+ var handleClick = function handleClick(event) {
152
+ if (showPanelButton && onClick) {
153
+ onClick(event);
154
+ } else {
155
+ sendVisitLinkAnalytics(INPUT_METHOD.BUTTON);
156
+ }
157
+ };
158
+ return (
159
+ // eslint-disable-next-line jsx-a11y/no-static-element-interactions
160
+ jsx("span", {
161
+ ref: containerRef,
162
+ css: containerStyles,
163
+ onDoubleClick: handleDoubleClick,
164
+ onMouseEnter: function onMouseEnter() {
165
+ return handleOverlayChange(true);
166
+ },
167
+ onMouseLeave: function onMouseLeave() {
168
+ return handleOverlayChange(false);
169
+ }
170
+ }, children, jsx("span", {
171
+ css: hiddenTextStyle,
172
+ "aria-hidden": "true"
173
+ }, jsx(Text, {
174
+ ref: hiddenTextRef,
175
+ size: "small",
176
+ maxLines: 1
177
+ }, label)), isHovered && jsx(Anchor, {
178
+ ref: hoverLinkButtonRef,
179
+ xcss: linkStyles,
180
+ href: url,
181
+ target: "_blank",
182
+ style: {
183
+ paddingBlock: compactPadding ? '1px' : "var(--ds-space-025, 2px)"
184
+ },
185
+ onClick: handleClick
186
+ }, jsx(Box, {
187
+ xcss: iconWrapperStyles,
188
+ "data-inlinecard-button-overlay": "icon-wrapper-line-height"
189
+ }, showPanelButton ? jsx(PanelRightIcon, {
190
+ label: ""
191
+ }) : jsx(LinkExternalIcon, {
192
+ label: ""
193
+ })), showLabel && jsx(Text, {
194
+ size: "small",
195
+ color: "color.text.subtle",
196
+ maxLines: 1
197
+ }, label)))
198
+ );
199
+ };
200
+ export default HoverLinkOverlay;
@@ -0,0 +1 @@
1
+ export {};
@@ -43,4 +43,5 @@ export { ToolbarExpandIcon } from './Toolbar/ExpandIcon';
43
43
  export { ToolbarSeparator } from './Toolbar/Separator';
44
44
  export { default as DropList } from './DropList';
45
45
  export { sharedMultiBodiedExtensionStyles } from './MultiBodiedExtension';
46
- export { default as TableSelectorPopup } from './TableSelector';
46
+ export { default as TableSelectorPopup } from './TableSelector';
47
+ export { default as HoverLinkOverlay } from './HoverLinkOverlay';
@@ -2,5 +2,6 @@ export declare const widerLayoutClassName = "wider-layout";
2
2
  export declare const wrapperStyleInheritedCursor: import("@emotion/react").SerializedStyles;
3
3
  export declare const header: import("@emotion/react").SerializedStyles;
4
4
  export declare const content: import("@emotion/react").SerializedStyles;
5
+ export declare const extensionContent: import("@emotion/react").SerializedStyles;
5
6
  export declare const contentWrapper: import("@emotion/react").SerializedStyles;
6
7
  export declare const overflowWrapperStyles: import("@emotion/react").SerializedStyles;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * **Warning: This hook is controlled by the `platform_editor_usesharedpluginstateselector` experiment.**
2
+ * **Warning: This hook is controlled by the `platform_editor_usesharedpluginstatewithselector` experiment.**
3
3
  *
4
4
  * This hook is a migrator for the legacy `useSharedPluginState` hook and will be removed in the future.
5
5
  * Please use `useSharedPluginStateSelector` instead.
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
+ import React from 'react';
6
+ import { jsx } from '@emotion/react';
7
+ import type { HoverLinkOverlayProps } from './types';
8
+ declare const HoverLinkOverlay: ({ children, isVisible, url, compactPadding, editorAnalyticsApi, view, onClick, showPanelButton, }: React.PropsWithChildren<HoverLinkOverlayProps>) => jsx.JSX.Element;
9
+ export default HoverLinkOverlay;
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
3
+ import type { EditorAnalyticsAPI } from '../../analytics';
4
+ export type HoverLinkOverlayProps = React.HTMLAttributes<HTMLSpanElement> & {
5
+ isVisible?: boolean;
6
+ url: string;
7
+ editorAnalyticsApi?: EditorAnalyticsAPI;
8
+ view?: EditorView;
9
+ onClick?: (event: React.MouseEvent<HTMLAnchorElement>) => void;
10
+ showPanelButton?: boolean;
11
+ compactPadding?: boolean;
12
+ };
@@ -55,3 +55,4 @@ export type { UseStickyToolbarType } from './Toolbar';
55
55
  export type { OpenChangedEvent } from './DropList';
56
56
  export { sharedMultiBodiedExtensionStyles } from './MultiBodiedExtension';
57
57
  export { default as TableSelectorPopup, type TableSelectorPopupProps } from './TableSelector';
58
+ export { default as HoverLinkOverlay } from './HoverLinkOverlay';
@@ -2,5 +2,6 @@ export declare const widerLayoutClassName = "wider-layout";
2
2
  export declare const wrapperStyleInheritedCursor: import("@emotion/react").SerializedStyles;
3
3
  export declare const header: import("@emotion/react").SerializedStyles;
4
4
  export declare const content: import("@emotion/react").SerializedStyles;
5
+ export declare const extensionContent: import("@emotion/react").SerializedStyles;
5
6
  export declare const contentWrapper: import("@emotion/react").SerializedStyles;
6
7
  export declare const overflowWrapperStyles: import("@emotion/react").SerializedStyles;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * **Warning: This hook is controlled by the `platform_editor_usesharedpluginstateselector` experiment.**
2
+ * **Warning: This hook is controlled by the `platform_editor_usesharedpluginstatewithselector` experiment.**
3
3
  *
4
4
  * This hook is a migrator for the legacy `useSharedPluginState` hook and will be removed in the future.
5
5
  * Please use `useSharedPluginStateSelector` instead.
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
+ import React from 'react';
6
+ import { jsx } from '@emotion/react';
7
+ import type { HoverLinkOverlayProps } from './types';
8
+ declare const HoverLinkOverlay: ({ children, isVisible, url, compactPadding, editorAnalyticsApi, view, onClick, showPanelButton, }: React.PropsWithChildren<HoverLinkOverlayProps>) => jsx.JSX.Element;
9
+ export default HoverLinkOverlay;
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
3
+ import type { EditorAnalyticsAPI } from '../../analytics';
4
+ export type HoverLinkOverlayProps = React.HTMLAttributes<HTMLSpanElement> & {
5
+ isVisible?: boolean;
6
+ url: string;
7
+ editorAnalyticsApi?: EditorAnalyticsAPI;
8
+ view?: EditorView;
9
+ onClick?: (event: React.MouseEvent<HTMLAnchorElement>) => void;
10
+ showPanelButton?: boolean;
11
+ compactPadding?: boolean;
12
+ };
@@ -55,3 +55,4 @@ export type { UseStickyToolbarType } from './Toolbar';
55
55
  export type { OpenChangedEvent } from './DropList';
56
56
  export { sharedMultiBodiedExtensionStyles } from './MultiBodiedExtension';
57
57
  export { default as TableSelectorPopup, type TableSelectorPopupProps } from './TableSelector';
58
+ export { default as HoverLinkOverlay } from './HoverLinkOverlay';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "107.12.4",
3
+ "version": "107.12.6",
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/"
@@ -144,7 +144,7 @@
144
144
  "@atlaskit/icon": "^27.7.0",
145
145
  "@atlaskit/icon-object": "^7.1.0",
146
146
  "@atlaskit/link": "^3.2.0",
147
- "@atlaskit/link-datasource": "^4.14.0",
147
+ "@atlaskit/link-datasource": "^4.15.0",
148
148
  "@atlaskit/link-picker": "^3.8.0",
149
149
  "@atlaskit/media-card": "^79.4.0",
150
150
  "@atlaskit/media-client": "^35.2.0",
@@ -171,7 +171,7 @@
171
171
  "@atlaskit/task-decision": "^19.2.0",
172
172
  "@atlaskit/textfield": "^8.0.0",
173
173
  "@atlaskit/theme": "^19.0.0",
174
- "@atlaskit/tmp-editor-statsig": "^9.12.0",
174
+ "@atlaskit/tmp-editor-statsig": "^9.14.0",
175
175
  "@atlaskit/tokens": "^5.6.0",
176
176
  "@atlaskit/tooltip": "^20.3.0",
177
177
  "@atlaskit/width-detector": "^5.0.0",