@atlaskit/editor-plugin-grid 11.0.8 → 11.0.12

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,32 @@
1
1
  # @atlaskit/editor-plugin-grid
2
2
 
3
+ ## 11.0.12
4
+
5
+ ### Patch Changes
6
+
7
+ - [`62bea93a6f5eb`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/62bea93a6f5eb) -
8
+ Add the `platform_editor_external_embed_grid_fix` experiment and use it to align editor grid
9
+ guidelines to the editor viewport while resizing external embeds.
10
+ - Updated dependencies
11
+
12
+ ## 11.0.11
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies
17
+
18
+ ## 11.0.10
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies
23
+
24
+ ## 11.0.9
25
+
26
+ ### Patch Changes
27
+
28
+ - Updated dependencies
29
+
3
30
  ## 11.0.8
4
31
 
5
32
  ### Patch Changes
@@ -20,6 +20,8 @@ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
20
20
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
21
21
 
22
22
  var GRID_SIZE = exports.GRID_SIZE = 12;
23
+ // Matches the existing `.gridParent` 12px left + 12px right gutter expansion.
24
+ var GRID_GUTTER_WIDTH = 24;
23
25
  var key = new _state.PluginKey('gridPlugin');
24
26
  var createDisplayGrid = function createDisplayGrid(view) {
25
27
  return function (props) {
@@ -103,6 +105,7 @@ var GridLegacy = function GridLegacy(_ref3) {
103
105
  containerElement = _ref3.containerElement,
104
106
  editorWidth = _ref3.editorWidth,
105
107
  gridType = _ref3.gridType,
108
+ overlayWidth = _ref3.overlayWidth,
106
109
  visible = _ref3.visible;
107
110
  var editorMaxWidth = theme.layoutMaxWidth;
108
111
  var gridLines = [].concat((0, _toConsumableArray2.default)(lineLengthGridLines(highlight)), (0, _toConsumableArray2.default)(gutterGridLines(editorMaxWidth, editorWidth, highlight, shouldCalcBreakoutGridLines)));
@@ -116,7 +119,8 @@ var GridLegacy = function GridLegacy(_ref3) {
116
119
  className: (0, _classnames.default)('gridContainer', gridType),
117
120
  style: {
118
121
  height: "".concat(containerElement.scrollHeight, "px"),
119
- display: visible ? 'block' : 'none'
122
+ display: visible ? 'block' : 'none',
123
+ width: overlayWidth === undefined ? undefined : "".concat(overlayWidth, "px")
120
124
  },
121
125
  "data-testid": "gridContainer"
122
126
  }, gridLines))
@@ -128,6 +132,7 @@ var GridNext = function GridNext(_ref4) {
128
132
  containerElement = _ref4.containerElement,
129
133
  editorWidth = _ref4.editorWidth,
130
134
  gridType = _ref4.gridType,
135
+ overlayWidth = _ref4.overlayWidth,
131
136
  visible = _ref4.visible;
132
137
  var editorMaxWidth = _editorSharedStyles.akEditorDefaultLayoutWidth;
133
138
  var gridLines = [].concat((0, _toConsumableArray2.default)(lineLengthGridLines(highlight)), (0, _toConsumableArray2.default)(gutterGridLines(editorMaxWidth, editorWidth, highlight, shouldCalcBreakoutGridLines)));
@@ -141,7 +146,8 @@ var GridNext = function GridNext(_ref4) {
141
146
  className: (0, _classnames.default)('gridContainer', gridType),
142
147
  style: {
143
148
  height: "".concat(containerElement.scrollHeight, "px"),
144
- display: visible ? 'block' : 'none'
149
+ display: visible ? 'block' : 'none',
150
+ width: overlayWidth === undefined ? undefined : "".concat(overlayWidth, "px")
145
151
  },
146
152
  "data-testid": "gridContainer"
147
153
  }, gridLines))
@@ -169,6 +175,9 @@ var ContentComponent = function ContentComponent(_ref5) {
169
175
  visible = _useSharedPluginState.visible,
170
176
  gridType = _useSharedPluginState.gridType,
171
177
  highlight = _useSharedPluginState.highlight;
178
+ var overlayWidth = _react.default.useMemo(function () {
179
+ return (0, _expValEquals.expValEquals)('platform_editor_external_embed_grid_fix', 'isEnabled', true) ? (editorView.dom.getBoundingClientRect().width || width || _editorSharedStyles.akEditorFullPageMaxWidth) + GRID_GUTTER_WIDTH : undefined;
180
+ }, [editorView.dom, width]);
172
181
  if (!visible || !highlight) {
173
182
  return null;
174
183
  }
@@ -181,7 +190,8 @@ var ContentComponent = function ContentComponent(_ref5) {
181
190
  containerElement: editorView.dom,
182
191
  visible: visible,
183
192
  gridType: gridType !== null && gridType !== void 0 ? gridType : 'full',
184
- highlight: highlight
193
+ highlight: highlight,
194
+ overlayWidth: overlayWidth
185
195
  });
186
196
  };
187
197
  var EMPTY_STATE = {
@@ -11,6 +11,8 @@ import { akEditorBreakoutPadding, akEditorDefaultLayoutWidth, akEditorFullPageMa
11
11
  import { componentWithCondition } from '@atlaskit/platform-feature-flags-react';
12
12
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
13
13
  export const GRID_SIZE = 12;
14
+ // Matches the existing `.gridParent` 12px left + 12px right gutter expansion.
15
+ const GRID_GUTTER_WIDTH = 24;
14
16
  const key = new PluginKey('gridPlugin');
15
17
  const createDisplayGrid = view => props => {
16
18
  const {
@@ -95,6 +97,7 @@ const GridLegacy = ({
95
97
  containerElement,
96
98
  editorWidth,
97
99
  gridType,
100
+ overlayWidth,
98
101
  visible
99
102
  }) => {
100
103
  const editorMaxWidth = theme.layoutMaxWidth;
@@ -109,7 +112,8 @@ const GridLegacy = ({
109
112
  className: classnames('gridContainer', gridType),
110
113
  style: {
111
114
  height: `${containerElement.scrollHeight}px`,
112
- display: visible ? 'block' : 'none'
115
+ display: visible ? 'block' : 'none',
116
+ width: overlayWidth === undefined ? undefined : `${overlayWidth}px`
113
117
  },
114
118
  "data-testid": "gridContainer"
115
119
  }, gridLines))
@@ -121,6 +125,7 @@ const GridNext = ({
121
125
  containerElement,
122
126
  editorWidth,
123
127
  gridType,
128
+ overlayWidth,
124
129
  visible
125
130
  }) => {
126
131
  const editorMaxWidth = akEditorDefaultLayoutWidth;
@@ -135,7 +140,8 @@ const GridNext = ({
135
140
  className: classnames('gridContainer', gridType),
136
141
  style: {
137
142
  height: `${containerElement.scrollHeight}px`,
138
- display: visible ? 'block' : 'none'
143
+ display: visible ? 'block' : 'none',
144
+ width: overlayWidth === undefined ? undefined : `${overlayWidth}px`
139
145
  },
140
146
  "data-testid": "gridContainer"
141
147
  }, gridLines))
@@ -163,6 +169,7 @@ const ContentComponent = ({
163
169
  gridType,
164
170
  highlight
165
171
  } = useSharedPluginStateWithSelector(api, ['width', 'grid'], selector);
172
+ const overlayWidth = React.useMemo(() => expValEquals('platform_editor_external_embed_grid_fix', 'isEnabled', true) ? (editorView.dom.getBoundingClientRect().width || width || akEditorFullPageMaxWidth) + GRID_GUTTER_WIDTH : undefined, [editorView.dom, width]);
166
173
  if (!visible || !highlight) {
167
174
  return null;
168
175
  }
@@ -175,7 +182,8 @@ const ContentComponent = ({
175
182
  containerElement: editorView.dom,
176
183
  visible: visible,
177
184
  gridType: gridType !== null && gridType !== void 0 ? gridType : 'full',
178
- highlight: highlight
185
+ highlight: highlight,
186
+ overlayWidth: overlayWidth
179
187
  });
180
188
  };
181
189
  const EMPTY_STATE = {
@@ -13,6 +13,8 @@ import { akEditorBreakoutPadding, akEditorDefaultLayoutWidth, akEditorFullPageMa
13
13
  import { componentWithCondition } from '@atlaskit/platform-feature-flags-react';
14
14
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
15
15
  export var GRID_SIZE = 12;
16
+ // Matches the existing `.gridParent` 12px left + 12px right gutter expansion.
17
+ var GRID_GUTTER_WIDTH = 24;
16
18
  var key = new PluginKey('gridPlugin');
17
19
  var createDisplayGrid = function createDisplayGrid(view) {
18
20
  return function (props) {
@@ -96,6 +98,7 @@ var GridLegacy = function GridLegacy(_ref3) {
96
98
  containerElement = _ref3.containerElement,
97
99
  editorWidth = _ref3.editorWidth,
98
100
  gridType = _ref3.gridType,
101
+ overlayWidth = _ref3.overlayWidth,
99
102
  visible = _ref3.visible;
100
103
  var editorMaxWidth = theme.layoutMaxWidth;
101
104
  var gridLines = [].concat(_toConsumableArray(lineLengthGridLines(highlight)), _toConsumableArray(gutterGridLines(editorMaxWidth, editorWidth, highlight, shouldCalcBreakoutGridLines)));
@@ -109,7 +112,8 @@ var GridLegacy = function GridLegacy(_ref3) {
109
112
  className: classnames('gridContainer', gridType),
110
113
  style: {
111
114
  height: "".concat(containerElement.scrollHeight, "px"),
112
- display: visible ? 'block' : 'none'
115
+ display: visible ? 'block' : 'none',
116
+ width: overlayWidth === undefined ? undefined : "".concat(overlayWidth, "px")
113
117
  },
114
118
  "data-testid": "gridContainer"
115
119
  }, gridLines))
@@ -121,6 +125,7 @@ var GridNext = function GridNext(_ref4) {
121
125
  containerElement = _ref4.containerElement,
122
126
  editorWidth = _ref4.editorWidth,
123
127
  gridType = _ref4.gridType,
128
+ overlayWidth = _ref4.overlayWidth,
124
129
  visible = _ref4.visible;
125
130
  var editorMaxWidth = akEditorDefaultLayoutWidth;
126
131
  var gridLines = [].concat(_toConsumableArray(lineLengthGridLines(highlight)), _toConsumableArray(gutterGridLines(editorMaxWidth, editorWidth, highlight, shouldCalcBreakoutGridLines)));
@@ -134,7 +139,8 @@ var GridNext = function GridNext(_ref4) {
134
139
  className: classnames('gridContainer', gridType),
135
140
  style: {
136
141
  height: "".concat(containerElement.scrollHeight, "px"),
137
- display: visible ? 'block' : 'none'
142
+ display: visible ? 'block' : 'none',
143
+ width: overlayWidth === undefined ? undefined : "".concat(overlayWidth, "px")
138
144
  },
139
145
  "data-testid": "gridContainer"
140
146
  }, gridLines))
@@ -162,6 +168,9 @@ var ContentComponent = function ContentComponent(_ref5) {
162
168
  visible = _useSharedPluginState.visible,
163
169
  gridType = _useSharedPluginState.gridType,
164
170
  highlight = _useSharedPluginState.highlight;
171
+ var overlayWidth = React.useMemo(function () {
172
+ return expValEquals('platform_editor_external_embed_grid_fix', 'isEnabled', true) ? (editorView.dom.getBoundingClientRect().width || width || akEditorFullPageMaxWidth) + GRID_GUTTER_WIDTH : undefined;
173
+ }, [editorView.dom, width]);
165
174
  if (!visible || !highlight) {
166
175
  return null;
167
176
  }
@@ -174,7 +183,8 @@ var ContentComponent = function ContentComponent(_ref5) {
174
183
  containerElement: editorView.dom,
175
184
  visible: visible,
176
185
  gridType: gridType !== null && gridType !== void 0 ? gridType : 'full',
177
- highlight: highlight
186
+ highlight: highlight,
187
+ overlayWidth: overlayWidth
178
188
  });
179
189
  };
180
190
  var EMPTY_STATE = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-grid",
3
- "version": "11.0.8",
3
+ "version": "11.0.12",
4
4
  "description": "Grid plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -25,13 +25,13 @@
25
25
  "@atlaskit/editor-prosemirror": "^7.3.0",
26
26
  "@atlaskit/editor-shared-styles": "^3.11.0",
27
27
  "@atlaskit/platform-feature-flags-react": "^0.5.0",
28
- "@atlaskit/tmp-editor-statsig": "^95.0.0",
28
+ "@atlaskit/tmp-editor-statsig": "^99.0.0",
29
29
  "@babel/runtime": "^7.0.0",
30
30
  "@emotion/react": "^11.7.1",
31
31
  "classnames": "^2.2.5"
32
32
  },
33
33
  "peerDependencies": {
34
- "@atlaskit/editor-common": "^115.10.0",
34
+ "@atlaskit/editor-common": "^115.13.0",
35
35
  "react": "^18.2.0",
36
36
  "react-dom": "^18.2.0"
37
37
  },