Fix SQL query editor cursor alignment issue (#28878)

for #27233 

# Checklist for submitter

- [X] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/Committing-Changes.md#changes-files)
for more information.

## Details

This PR fixes an issue where the cursor in the SQL editor would become
misaligned under some circumstances. I was never able to reproduce this
personally, but big thanks to @mason-buettner for both the reproduction
and testing this fix.

The issue seems to stem from the Ace editor having a hard time dealing
with CSS scaling. I'm not sure what circumstances actually cause this to
occur, but a combination of Google and ChatGPT lead me to
https://github.com/securingsincity/react-ace/issues/750 and
https://github.com/ajaxorg/ace/issues/4794 which I combined for this fix
which seems to work.
This commit is contained in:
Scott Gress 2025-05-20 16:56:52 -05:00 committed by GitHub
parent f6da8ee67b
commit 28ba274f1f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 1 deletions

View file

@ -0,0 +1 @@
- Fixed an issue where the cursor on the SQL editor would sometimes become misaliged

View file

@ -280,7 +280,7 @@ const SQLEditor = ({
onBlur={onBlurHandler}
onLoad={onLoadHandler}
readOnly={readOnly}
setOptions={{ enableLinking: true }}
setOptions={{ enableLinking: true, hasCssTransforms: true }}
showGutter={showGutter}
showPrintMargin={false}
theme="fleet"

View file

@ -53,3 +53,10 @@
margin: 0;
}
}
.sql-editor,
.sql-editor * {
letter-spacing: normal !important;
word-spacing: normal !important;
font-family: 'SourceCodePro', monospace !important;
}