@atlaskit/editor-plugin-layout 23.0.3 → 23.0.4

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.
@@ -1,62 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
- import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
5
- import { fg } from '@atlaskit/platform-feature-flags/fg';
6
- export var LAYOUT_COLUMN_MENU_POPUP_OFFSET = [0, 4];
7
-
8
- // Gate OFF: small gap below the handle; Popup handles invert/nudge fallbacks.
9
- export var LAYOUT_COLUMN_MENU_POPUP_OFFSET_BELOW = [0, 2];
10
- // Gate OFF: left-aligned, below the handle. Gate ON (legacy): centred, prefer above with manual flip.
11
- export var getLayoutColumnMenuPositioningProps = function getLayoutColumnMenuPositioningProps() {
12
- if (!fg('platform_editor_layout_column_menu_kill_switch_1')) {
13
- return {
14
- alignX: undefined,
15
- alignY: undefined,
16
- offset: LAYOUT_COLUMN_MENU_POPUP_OFFSET_BELOW,
17
- useManualBelowFlip: false
18
- };
19
- }
20
- return {
21
- alignX: 'center',
22
- alignY: 'top',
23
- offset: LAYOUT_COLUMN_MENU_POPUP_OFFSET,
24
- useManualBelowFlip: true
25
- };
26
- };
27
- var getVisibleEditorAreaTop = function getVisibleEditorAreaTop(editorView, scrollableElement) {
28
- var visibleEditorArea = scrollableElement || findOverflowScrollParent(editorView.dom);
29
- return Math.max(visibleEditorArea ? visibleEditorArea.getBoundingClientRect().top : 0, 0);
30
- };
31
-
32
- // Prefer opening above the column drag handle, but fall back below when the visible editor
33
- // area does not have enough space above (for example near the top toolbar).
34
- export var shouldOpenLayoutColumnMenuBelow = function shouldOpenLayoutColumnMenuBelow(_ref) {
35
- var editorView = _ref.editorView,
36
- popup = _ref.popup,
37
- scrollableElement = _ref.scrollableElement,
38
- target = _ref.target;
39
- var offsetY = LAYOUT_COLUMN_MENU_POPUP_OFFSET[1];
40
- var spaceAbove = target.getBoundingClientRect().top - getVisibleEditorAreaTop(editorView, scrollableElement);
41
- var popupHeight = popup.getBoundingClientRect().height || popup.clientHeight;
42
- return spaceAbove <= popupHeight + offsetY;
43
- };
44
- export var calculateFallbackBottomPosition = function calculateFallbackBottomPosition(position, target, popup) {
45
- if (!(popup.offsetParent instanceof HTMLElement)) {
46
- return position;
47
- }
48
- var offsetParent = popup.offsetParent;
49
- var borderBottomWidth = parseInt(window.getComputedStyle(offsetParent).borderBottomWidth, 10) || 0;
50
- var _offsetParent$getBoun = offsetParent.getBoundingClientRect(),
51
- offsetParentTop = _offsetParent$getBoun.top;
52
- var _target$getBoundingCl = target.getBoundingClientRect(),
53
- targetTop = _target$getBoundingCl.top,
54
- targetHeight = _target$getBoundingCl.height;
55
- var offsetY = LAYOUT_COLUMN_MENU_POPUP_OFFSET[1];
56
- var top = Math.ceil(targetTop - offsetParentTop + targetHeight + (offsetParent === offsetParent.ownerDocument.body ? 0 : offsetParent.scrollTop) - borderBottomWidth + offsetY);
57
- var positionWithoutBottom = _objectSpread({}, position);
58
- delete positionWithoutBottom.bottom;
59
- return _objectSpread(_objectSpread({}, positionWithoutBottom), {}, {
60
- top: top
61
- });
62
- };
@@ -1,19 +0,0 @@
1
- import { type PopupPosition } from '@atlaskit/editor-common/ui';
2
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
3
- export declare const LAYOUT_COLUMN_MENU_POPUP_OFFSET: [number, number];
4
- export declare const LAYOUT_COLUMN_MENU_POPUP_OFFSET_BELOW: [number, number];
5
- type LayoutColumnMenuPositioningProps = {
6
- alignX: 'center' | undefined;
7
- alignY: 'top' | undefined;
8
- offset: [number, number];
9
- useManualBelowFlip: boolean;
10
- };
11
- export declare const getLayoutColumnMenuPositioningProps: () => LayoutColumnMenuPositioningProps;
12
- export declare const shouldOpenLayoutColumnMenuBelow: ({ editorView, popup, scrollableElement, target, }: {
13
- editorView: EditorView;
14
- popup: HTMLElement;
15
- scrollableElement?: HTMLElement;
16
- target: HTMLElement;
17
- }) => boolean;
18
- export declare const calculateFallbackBottomPosition: (position: PopupPosition, target: HTMLElement, popup: HTMLElement) => PopupPosition;
19
- export {};