@atlaskit/editor-plugin-card 6.7.1 → 6.8.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-plugin-card
2
2
 
3
+ ## 6.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#180491](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/180491)
8
+ [`33c19072599ca`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/33c19072599ca) -
9
+ Tidied up smart card overlay experiment
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
3
15
  ## 6.7.1
4
16
 
5
17
  ### Patch Changes
@@ -14,7 +14,6 @@ var _analytics = require("@atlaskit/editor-common/analytics");
14
14
  var _messages = require("@atlaskit/editor-common/messages");
15
15
  var _linkExternal = _interopRequireDefault(require("@atlaskit/icon/core/link-external"));
16
16
  var _primitives = require("@atlaskit/primitives");
17
- var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
18
17
  var _toolbar = require("../toolbar");
19
18
  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
19
  /* eslint-disable @atlaskit/design-system/no-nested-styles */
@@ -94,26 +93,6 @@ var OpenButtonOverlay = function OpenButtonOverlay(_ref) {
94
93
  isHovered = _useState4[0],
95
94
  setHovered = _useState4[1];
96
95
  var openTextWidthRef = (0, _react.useRef)(null);
97
- (0, _react.useLayoutEffect)(function () {
98
- if ((0, _experiments.editorExperiment)('platform_editor_smart_card_open_overlay_perf', false, {
99
- exposure: true
100
- })) {
101
- var hiddenText = hiddenTextRef.current;
102
- if (!hiddenText) {
103
- openTextWidthRef.current = DEFAULT_OPEN_TEXT_WIDTH;
104
- return;
105
- }
106
- // Measure the width of the hidden text
107
- // Temporarily make the element visible to measure its width
108
- hiddenText.style.visibility = 'hidden';
109
- hiddenText.style.display = 'inline';
110
- openTextWidthRef.current = hiddenText.offsetWidth;
111
-
112
- // Reset the hiddenText's display property
113
- hiddenText.style.display = 'none';
114
- hiddenText.style.visibility = 'inherit';
115
- }
116
- }, []);
117
96
  (0, _react.useLayoutEffect)(function () {
118
97
  var _containerRef$current, _openButtonRef$curren;
119
98
  if (!isVisible || !isHovered) {
@@ -123,24 +102,20 @@ var OpenButtonOverlay = function OpenButtonOverlay(_ref) {
123
102
  var openButtonWidth = (_openButtonRef$curren = openButtonRef.current) === null || _openButtonRef$curren === void 0 ? void 0 : _openButtonRef$curren.offsetWidth;
124
103
 
125
104
  // Get the hidden text width
126
- if ((0, _experiments.editorExperiment)('platform_editor_smart_card_open_overlay_perf', true, {
127
- exposure: true
128
- })) {
129
- if (!openTextWidthRef.current) {
130
- var hiddenText = hiddenTextRef.current;
131
- if (hiddenText) {
132
- // Measure the width of the hidden text
133
- // Temporarily make the element visible to measure its width
134
- hiddenText.style.visibility = 'hidden';
135
- hiddenText.style.display = 'inline';
136
- openTextWidthRef.current = hiddenText.offsetWidth;
105
+ if (!openTextWidthRef.current) {
106
+ var hiddenText = hiddenTextRef.current;
107
+ if (hiddenText) {
108
+ // Measure the width of the hidden text
109
+ // Temporarily make the element visible to measure its width
110
+ hiddenText.style.visibility = 'hidden';
111
+ hiddenText.style.display = 'inline';
112
+ openTextWidthRef.current = hiddenText.offsetWidth;
137
113
 
138
- // Reset the hiddenText's display property
139
- hiddenText.style.display = 'none';
140
- hiddenText.style.visibility = 'inherit';
141
- } else {
142
- openTextWidthRef.current = DEFAULT_OPEN_TEXT_WIDTH;
143
- }
114
+ // Reset the hiddenText's display property
115
+ hiddenText.style.display = 'none';
116
+ hiddenText.style.visibility = 'inherit';
117
+ } else {
118
+ openTextWidthRef.current = DEFAULT_OPEN_TEXT_WIDTH;
144
119
  }
145
120
  }
146
121
  if (!cardWidth || !openButtonWidth) {
@@ -12,7 +12,6 @@ import { cardMessages } from '@atlaskit/editor-common/messages';
12
12
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
13
13
  import LinkExternalIcon from '@atlaskit/icon/core/link-external';
14
14
  import { Anchor, Box, Text, xcss } from '@atlaskit/primitives';
15
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
16
15
  import { visitCardLinkAnalytics } from '../toolbar';
17
16
  const containerStyles = css({
18
17
  position: 'relative'
@@ -75,26 +74,6 @@ const OpenButtonOverlay = ({
75
74
  const [showLabel, setShowLabel] = useState(true);
76
75
  const [isHovered, setHovered] = useState(false);
77
76
  const openTextWidthRef = useRef(null);
78
- useLayoutEffect(() => {
79
- if (editorExperiment('platform_editor_smart_card_open_overlay_perf', false, {
80
- exposure: true
81
- })) {
82
- const hiddenText = hiddenTextRef.current;
83
- if (!hiddenText) {
84
- openTextWidthRef.current = DEFAULT_OPEN_TEXT_WIDTH;
85
- return;
86
- }
87
- // Measure the width of the hidden text
88
- // Temporarily make the element visible to measure its width
89
- hiddenText.style.visibility = 'hidden';
90
- hiddenText.style.display = 'inline';
91
- openTextWidthRef.current = hiddenText.offsetWidth;
92
-
93
- // Reset the hiddenText's display property
94
- hiddenText.style.display = 'none';
95
- hiddenText.style.visibility = 'inherit';
96
- }
97
- }, []);
98
77
  useLayoutEffect(() => {
99
78
  var _containerRef$current, _openButtonRef$curren;
100
79
  if (!isVisible || !isHovered) {
@@ -104,24 +83,20 @@ const OpenButtonOverlay = ({
104
83
  const openButtonWidth = (_openButtonRef$curren = openButtonRef.current) === null || _openButtonRef$curren === void 0 ? void 0 : _openButtonRef$curren.offsetWidth;
105
84
 
106
85
  // Get the hidden text width
107
- if (editorExperiment('platform_editor_smart_card_open_overlay_perf', true, {
108
- exposure: true
109
- })) {
110
- if (!openTextWidthRef.current) {
111
- const hiddenText = hiddenTextRef.current;
112
- if (hiddenText) {
113
- // Measure the width of the hidden text
114
- // Temporarily make the element visible to measure its width
115
- hiddenText.style.visibility = 'hidden';
116
- hiddenText.style.display = 'inline';
117
- openTextWidthRef.current = hiddenText.offsetWidth;
86
+ if (!openTextWidthRef.current) {
87
+ const hiddenText = hiddenTextRef.current;
88
+ if (hiddenText) {
89
+ // Measure the width of the hidden text
90
+ // Temporarily make the element visible to measure its width
91
+ hiddenText.style.visibility = 'hidden';
92
+ hiddenText.style.display = 'inline';
93
+ openTextWidthRef.current = hiddenText.offsetWidth;
118
94
 
119
- // Reset the hiddenText's display property
120
- hiddenText.style.display = 'none';
121
- hiddenText.style.visibility = 'inherit';
122
- } else {
123
- openTextWidthRef.current = DEFAULT_OPEN_TEXT_WIDTH;
124
- }
95
+ // Reset the hiddenText's display property
96
+ hiddenText.style.display = 'none';
97
+ hiddenText.style.visibility = 'inherit';
98
+ } else {
99
+ openTextWidthRef.current = DEFAULT_OPEN_TEXT_WIDTH;
125
100
  }
126
101
  }
127
102
  if (!cardWidth || !openButtonWidth) {
@@ -13,7 +13,6 @@ import { cardMessages } from '@atlaskit/editor-common/messages';
13
13
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
14
14
  import LinkExternalIcon from '@atlaskit/icon/core/link-external';
15
15
  import { Anchor, Box, Text, xcss } from '@atlaskit/primitives';
16
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
17
16
  import { visitCardLinkAnalytics } from '../toolbar';
18
17
  var containerStyles = css({
19
18
  position: 'relative'
@@ -81,26 +80,6 @@ var OpenButtonOverlay = function OpenButtonOverlay(_ref) {
81
80
  isHovered = _useState4[0],
82
81
  setHovered = _useState4[1];
83
82
  var openTextWidthRef = useRef(null);
84
- useLayoutEffect(function () {
85
- if (editorExperiment('platform_editor_smart_card_open_overlay_perf', false, {
86
- exposure: true
87
- })) {
88
- var hiddenText = hiddenTextRef.current;
89
- if (!hiddenText) {
90
- openTextWidthRef.current = DEFAULT_OPEN_TEXT_WIDTH;
91
- return;
92
- }
93
- // Measure the width of the hidden text
94
- // Temporarily make the element visible to measure its width
95
- hiddenText.style.visibility = 'hidden';
96
- hiddenText.style.display = 'inline';
97
- openTextWidthRef.current = hiddenText.offsetWidth;
98
-
99
- // Reset the hiddenText's display property
100
- hiddenText.style.display = 'none';
101
- hiddenText.style.visibility = 'inherit';
102
- }
103
- }, []);
104
83
  useLayoutEffect(function () {
105
84
  var _containerRef$current, _openButtonRef$curren;
106
85
  if (!isVisible || !isHovered) {
@@ -110,24 +89,20 @@ var OpenButtonOverlay = function OpenButtonOverlay(_ref) {
110
89
  var openButtonWidth = (_openButtonRef$curren = openButtonRef.current) === null || _openButtonRef$curren === void 0 ? void 0 : _openButtonRef$curren.offsetWidth;
111
90
 
112
91
  // Get the hidden text width
113
- if (editorExperiment('platform_editor_smart_card_open_overlay_perf', true, {
114
- exposure: true
115
- })) {
116
- if (!openTextWidthRef.current) {
117
- var hiddenText = hiddenTextRef.current;
118
- if (hiddenText) {
119
- // Measure the width of the hidden text
120
- // Temporarily make the element visible to measure its width
121
- hiddenText.style.visibility = 'hidden';
122
- hiddenText.style.display = 'inline';
123
- openTextWidthRef.current = hiddenText.offsetWidth;
92
+ if (!openTextWidthRef.current) {
93
+ var hiddenText = hiddenTextRef.current;
94
+ if (hiddenText) {
95
+ // Measure the width of the hidden text
96
+ // Temporarily make the element visible to measure its width
97
+ hiddenText.style.visibility = 'hidden';
98
+ hiddenText.style.display = 'inline';
99
+ openTextWidthRef.current = hiddenText.offsetWidth;
124
100
 
125
- // Reset the hiddenText's display property
126
- hiddenText.style.display = 'none';
127
- hiddenText.style.visibility = 'inherit';
128
- } else {
129
- openTextWidthRef.current = DEFAULT_OPEN_TEXT_WIDTH;
130
- }
101
+ // Reset the hiddenText's display property
102
+ hiddenText.style.display = 'none';
103
+ hiddenText.style.visibility = 'inherit';
104
+ } else {
105
+ openTextWidthRef.current = DEFAULT_OPEN_TEXT_WIDTH;
131
106
  }
132
107
  }
133
108
  if (!cardWidth || !openButtonWidth) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-card",
3
- "version": "6.7.1",
3
+ "version": "6.8.0",
4
4
  "description": "Card plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -36,7 +36,7 @@
36
36
  "@atlaskit/analytics-next": "^11.1.0",
37
37
  "@atlaskit/button": "^23.2.0",
38
38
  "@atlaskit/custom-steps": "^0.11.0",
39
- "@atlaskit/editor-common": "^107.4.0",
39
+ "@atlaskit/editor-common": "^107.5.0",
40
40
  "@atlaskit/editor-plugin-analytics": "^2.3.0",
41
41
  "@atlaskit/editor-plugin-base": "^3.0.0",
42
42
  "@atlaskit/editor-plugin-connectivity": "^2.0.0",
@@ -44,7 +44,7 @@
44
44
  "@atlaskit/editor-plugin-editor-disabled": "^2.1.0",
45
45
  "@atlaskit/editor-plugin-editor-viewmode": "^4.0.0",
46
46
  "@atlaskit/editor-plugin-feature-flags": "^1.4.0",
47
- "@atlaskit/editor-plugin-floating-toolbar": "^4.2.0",
47
+ "@atlaskit/editor-plugin-floating-toolbar": "^4.3.0",
48
48
  "@atlaskit/editor-plugin-grid": "^2.0.0",
49
49
  "@atlaskit/editor-plugin-width": "^3.0.0",
50
50
  "@atlaskit/editor-prosemirror": "7.0.0",
@@ -62,7 +62,7 @@
62
62
  "@atlaskit/primitives": "^14.10.0",
63
63
  "@atlaskit/smart-card": "^38.20.0",
64
64
  "@atlaskit/theme": "^18.0.0",
65
- "@atlaskit/tmp-editor-statsig": "^8.6.0",
65
+ "@atlaskit/tmp-editor-statsig": "^8.7.0",
66
66
  "@atlaskit/tokens": "^5.4.0",
67
67
  "@babel/runtime": "^7.0.0",
68
68
  "@emotion/react": "^11.7.1",