Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {
getTokenTypeColor,
getChipDisplayContent
} from "./chipStyles";
import { HELPER_PANE_WIDTH } from "./constants";

export type TokenStream = number[];

Expand Down Expand Up @@ -443,7 +444,6 @@ export const buildOnFocusListner = (onTrigger: (cursor: CursorInfo) => void) =>
let relativeTop = coords.bottom - editorRect.top + 5;
let relativeLeft = coords.left - editorRect.left;

const HELPER_PANE_WIDTH = 300;
const editorWidth = editorRect.width;
const relativeRight = relativeLeft + HELPER_PANE_WIDTH;
const overflow = relativeRight - editorWidth;
Expand Down Expand Up @@ -477,7 +477,6 @@ export const buildOnSelectionChange = (onTrigger: (cursor: CursorInfo) => void)
let relativeTop = coords.bottom - editorRect.top + 5;
let relativeLeft = coords.left - editorRect.left;

const HELPER_PANE_WIDTH = 300;
const editorWidth = editorRect.width;
const relativeRight = relativeLeft + HELPER_PANE_WIDTH;
const overflow = relativeRight - editorWidth;
Expand Down Expand Up @@ -548,7 +547,6 @@ export const buildOnChangeListner = (onTrigeer: (newValue: string, cursor: Curso
let relativeTop = coords.bottom - editorRect.top + 5;
let relativeLeft = coords.left - editorRect.left;

const HELPER_PANE_WIDTH = 300;
const editorWidth = editorRect.width;
const relativeRight = relativeLeft + HELPER_PANE_WIDTH;
const overflow = relativeRight - editorWidth;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import FXButton from "./FxButton";
import { HelperPaneToggleButton } from "./HelperPaneToggleButton";
import { HelperPane } from "./HelperPane";
import { listContinuationKeymap } from "../../../ExpandedEditor/utils/templateUtils";
import { HELPER_PANE_WIDTH } from "../constants";

type HelperPaneState = {
isOpen: boolean;
Expand Down Expand Up @@ -245,11 +246,10 @@ export const ChipExpressionEditorComponent = (props: ChipExpressionEditorCompone
let top = buttonRect.bottom - editorRect.top;
let left = buttonRect.left - editorRect.left;

// Add overflow correction for window boundaries
const HELPER_PANE_WIDTH = 300;
const viewportWidth = window.innerWidth;
const absoluteLeft = buttonRect.left;
const overflow = absoluteLeft + HELPER_PANE_WIDTH - viewportWidth;
// Add overflow correction for editor boundaries
const editorWidth = editorRect.width;
const relativeRight = left + HELPER_PANE_WIDTH;
const overflow = relativeRight - editorWidth;

if (overflow > 0) {
left -= overflow;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

export const CHIP_EXPRESSION_EDITOR_HEIGHT = 26;
export const EXPANDED_EDITOR_HEIGHT = 500;
export const HELPER_PANE_WIDTH = 300;

// Data attributes
export const DATA_CHIP_ATTRIBUTE = 'data-chip';
Expand Down
Loading