@atlaskit/editor-plugin-grid 11.0.14 → 11.0.16

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-plugin-grid
2
2
 
3
+ ## 11.0.16
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 11.0.15
10
+
11
+ ### Patch Changes
12
+
13
+ - [`0117f2bf00eb2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0117f2bf00eb2) -
14
+ Use editor line length rather than editor DOM width for the external embed grid guideline fix so
15
+ guidelines stay aligned in wide editor layouts.
16
+ - Updated dependencies
17
+
3
18
  ## 11.0.14
4
19
 
5
20
  ### Patch Changes
@@ -158,9 +158,10 @@ var ThemedGrid = (0, _platformFeatureFlagsReact.componentWithCondition)(function
158
158
  return (0, _expValEquals.expValEquals)('platform_editor_core_non_ecc_static_css', 'isEnabled', true) || (0, _expValEquals.expValEquals)('platform_editor_core_static_css', 'isEnabled', true);
159
159
  }, GridNext, ThemedGridLegacy);
160
160
  var selector = function selector(states) {
161
- var _states$widthState, _states$gridState, _states$gridState2, _states$gridState3;
161
+ var _states$widthState, _states$widthState2, _states$gridState, _states$gridState2, _states$gridState3;
162
162
  return {
163
- width: (_states$widthState = states.widthState) === null || _states$widthState === void 0 ? void 0 : _states$widthState.width,
163
+ lineLength: (_states$widthState = states.widthState) === null || _states$widthState === void 0 ? void 0 : _states$widthState.lineLength,
164
+ width: (_states$widthState2 = states.widthState) === null || _states$widthState2 === void 0 ? void 0 : _states$widthState2.width,
164
165
  visible: (_states$gridState = states.gridState) === null || _states$gridState === void 0 ? void 0 : _states$gridState.visible,
165
166
  gridType: (_states$gridState2 = states.gridState) === null || _states$gridState2 === void 0 ? void 0 : _states$gridState2.gridType,
166
167
  highlight: (_states$gridState3 = states.gridState) === null || _states$gridState3 === void 0 ? void 0 : _states$gridState3.highlight
@@ -171,13 +172,12 @@ var ContentComponent = function ContentComponent(_ref5) {
171
172
  editorView = _ref5.editorView,
172
173
  options = _ref5.options;
173
174
  var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['width', 'grid'], selector),
175
+ lineLength = _useSharedPluginState.lineLength,
174
176
  width = _useSharedPluginState.width,
175
177
  visible = _useSharedPluginState.visible,
176
178
  gridType = _useSharedPluginState.gridType,
177
179
  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]);
180
+ var overlayWidth = (0, _expValEquals.expValEquals)('platform_editor_external_embed_grid_fix', 'isEnabled', true) ? (lineLength || width || _editorSharedStyles.akEditorFullPageMaxWidth) + GRID_GUTTER_WIDTH : undefined;
181
181
  if (!visible || !highlight) {
182
182
  return null;
183
183
  }
@@ -150,9 +150,10 @@ const GridNext = ({
150
150
  const ThemedGridLegacy = withTheme(GridLegacy);
151
151
  const ThemedGrid = componentWithCondition(() => expValEquals('platform_editor_core_non_ecc_static_css', 'isEnabled', true) || expValEquals('platform_editor_core_static_css', 'isEnabled', true), GridNext, ThemedGridLegacy);
152
152
  const selector = states => {
153
- var _states$widthState, _states$gridState, _states$gridState2, _states$gridState3;
153
+ var _states$widthState, _states$widthState2, _states$gridState, _states$gridState2, _states$gridState3;
154
154
  return {
155
- width: (_states$widthState = states.widthState) === null || _states$widthState === void 0 ? void 0 : _states$widthState.width,
155
+ lineLength: (_states$widthState = states.widthState) === null || _states$widthState === void 0 ? void 0 : _states$widthState.lineLength,
156
+ width: (_states$widthState2 = states.widthState) === null || _states$widthState2 === void 0 ? void 0 : _states$widthState2.width,
156
157
  visible: (_states$gridState = states.gridState) === null || _states$gridState === void 0 ? void 0 : _states$gridState.visible,
157
158
  gridType: (_states$gridState2 = states.gridState) === null || _states$gridState2 === void 0 ? void 0 : _states$gridState2.gridType,
158
159
  highlight: (_states$gridState3 = states.gridState) === null || _states$gridState3 === void 0 ? void 0 : _states$gridState3.highlight
@@ -164,12 +165,13 @@ const ContentComponent = ({
164
165
  options
165
166
  }) => {
166
167
  const {
168
+ lineLength,
167
169
  width,
168
170
  visible,
169
171
  gridType,
170
172
  highlight
171
173
  } = 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]);
174
+ const overlayWidth = expValEquals('platform_editor_external_embed_grid_fix', 'isEnabled', true) ? (lineLength || width || akEditorFullPageMaxWidth) + GRID_GUTTER_WIDTH : undefined;
173
175
  if (!visible || !highlight) {
174
176
  return null;
175
177
  }
@@ -151,9 +151,10 @@ var ThemedGrid = componentWithCondition(function () {
151
151
  return expValEquals('platform_editor_core_non_ecc_static_css', 'isEnabled', true) || expValEquals('platform_editor_core_static_css', 'isEnabled', true);
152
152
  }, GridNext, ThemedGridLegacy);
153
153
  var selector = function selector(states) {
154
- var _states$widthState, _states$gridState, _states$gridState2, _states$gridState3;
154
+ var _states$widthState, _states$widthState2, _states$gridState, _states$gridState2, _states$gridState3;
155
155
  return {
156
- width: (_states$widthState = states.widthState) === null || _states$widthState === void 0 ? void 0 : _states$widthState.width,
156
+ lineLength: (_states$widthState = states.widthState) === null || _states$widthState === void 0 ? void 0 : _states$widthState.lineLength,
157
+ width: (_states$widthState2 = states.widthState) === null || _states$widthState2 === void 0 ? void 0 : _states$widthState2.width,
157
158
  visible: (_states$gridState = states.gridState) === null || _states$gridState === void 0 ? void 0 : _states$gridState.visible,
158
159
  gridType: (_states$gridState2 = states.gridState) === null || _states$gridState2 === void 0 ? void 0 : _states$gridState2.gridType,
159
160
  highlight: (_states$gridState3 = states.gridState) === null || _states$gridState3 === void 0 ? void 0 : _states$gridState3.highlight
@@ -164,13 +165,12 @@ var ContentComponent = function ContentComponent(_ref5) {
164
165
  editorView = _ref5.editorView,
165
166
  options = _ref5.options;
166
167
  var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['width', 'grid'], selector),
168
+ lineLength = _useSharedPluginState.lineLength,
167
169
  width = _useSharedPluginState.width,
168
170
  visible = _useSharedPluginState.visible,
169
171
  gridType = _useSharedPluginState.gridType,
170
172
  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]);
173
+ var overlayWidth = expValEquals('platform_editor_external_embed_grid_fix', 'isEnabled', true) ? (lineLength || width || akEditorFullPageMaxWidth) + GRID_GUTTER_WIDTH : undefined;
174
174
  if (!visible || !highlight) {
175
175
  return null;
176
176
  }
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/entry-points/gridPlugin.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/entry-points/gridPlugin.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/entry-points/gridPlugin.d.ts"
17
10
  }
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/entry-points/gridPluginType.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/entry-points/gridPluginType.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/entry-points/gridPluginType.d.ts"
17
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-grid",
3
- "version": "11.0.14",
3
+ "version": "11.0.16",
4
4
  "description": "Grid plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -25,7 +25,7 @@
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": "^101.0.0",
28
+ "@atlaskit/tmp-editor-statsig": "^103.0.0",
29
29
  "@babel/runtime": "^7.0.0",
30
30
  "@emotion/react": "^11.7.1",
31
31
  "classnames": "^2.2.5"
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/entry-points/types.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/entry-points/types.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/entry-points/types.d.ts"
17
10
  }
@@ -1 +0,0 @@
1
- export { gridPlugin } from '../gridPlugin';
@@ -1 +0,0 @@
1
- export type { GridPlugin, GridPluginDependencies, GridPluginSharedState, GridPluginActions, GridPluginConfiguration, } from '../gridPluginType';
@@ -1 +0,0 @@
1
- export type { CreateDisplayGrid, Highlights, GridPluginOptions, GridPluginState, } from '../types/index';
@@ -1,7 +0,0 @@
1
- import type { GridPlugin } from './gridPluginType';
2
- export declare const GRID_SIZE = 12;
3
- /**
4
- * Grid plugin to be added to an `EditorPresetBuilder` and used with `ComposableEditor`
5
- * from `@atlaskit/editor-core`.
6
- */
7
- export declare const gridPlugin: GridPlugin;
@@ -1,17 +0,0 @@
1
- import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
2
- import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
3
- import type { CreateDisplayGrid, GridPluginOptions, GridPluginState } from './types';
4
- export type GridPluginConfiguration = GridPluginOptions | undefined;
5
- export type GridPluginDependencies = [
6
- WidthPlugin
7
- ];
8
- export type GridPluginSharedState = GridPluginState | null;
9
- export type GridPluginActions = {
10
- displayGrid: CreateDisplayGrid;
11
- };
12
- export type GridPlugin = NextEditorPlugin<'grid', {
13
- actions: GridPluginActions;
14
- dependencies: GridPluginDependencies;
15
- pluginConfiguration: GridPluginConfiguration;
16
- sharedState: GridPluginSharedState;
17
- }>;
@@ -1,3 +0,0 @@
1
- export { gridPlugin } from './gridPlugin';
2
- export type { GridPlugin, GridPluginDependencies, GridPluginSharedState, GridPluginActions, GridPluginConfiguration, } from './gridPluginType';
3
- export type { CreateDisplayGrid, Highlights, GridPluginOptions, GridPluginState } from './types';
@@ -1,17 +0,0 @@
1
- import type { GridType } from '@atlaskit/editor-common/types';
2
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
3
- export type Highlights = Array<'wide' | 'full-width' | number>;
4
- export type GridPluginState = {
5
- gridType?: GridType;
6
- highlight: Highlights;
7
- visible: boolean;
8
- };
9
- type Required<T> = {
10
- [P in keyof T]-?: T[P];
11
- };
12
- type DisplayGrid = (props: Required<GridPluginState>) => boolean;
13
- export type CreateDisplayGrid = (view: EditorView) => DisplayGrid;
14
- export interface GridPluginOptions {
15
- shouldCalcBreakoutGridLines?: boolean;
16
- }
17
- export {};