Skip to content

Commit

Permalink
fix: remove redundant box around EditableWrapper, minor style tweaks …
Browse files Browse the repository at this point in the history
…to change highlight positioning
  • Loading branch information
robinpyon committed May 13, 2024
1 parent 2821945 commit 63dd0ff
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 18 deletions.
23 changes: 6 additions & 17 deletions packages/sanity/src/core/form/inputs/PortableText/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,7 @@ import {
type RenderStyleFunction,
} from '@sanity/portable-text-editor'
import {type Path} from '@sanity/types'
import {
BoundaryElementProvider,
Box,
useBoundaryElement,
useGlobalKeyDown,
useLayer,
} from '@sanity/ui'
import {BoundaryElementProvider, useBoundaryElement, useGlobalKeyDown, useLayer} from '@sanity/ui'
// eslint-disable-next-line camelcase
import {getTheme_v2} from '@sanity/ui/theme'
import {type ReactNode, useCallback, useMemo} from 'react'
Expand Down Expand Up @@ -210,16 +204,11 @@ export function Editor(props: EditorProps): ReactNode {

<EditableCard flex={1} tone={readOnly ? 'transparent' : 'default'}>
<Scroller ref={setScrollElement}>
<Box>
<EditableWrapper
$isFullscreen={isFullscreen}
tone={readOnly ? 'transparent' : 'default'}
>
<BoundaryElementProvider element={isFullscreen ? scrollElement : boundaryElement}>
{editable}
</BoundaryElementProvider>
</EditableWrapper>
</Box>
<EditableWrapper $isFullscreen={isFullscreen} tone={readOnly ? 'transparent' : 'default'}>
<BoundaryElementProvider element={isFullscreen ? scrollElement : boundaryElement}>
{editable}
</BoundaryElementProvider>
</EditableWrapper>
</Scroller>

<div data-portal="" ref={setPortalElement} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const ReviewChangesHighlightBlock = styled.div(({theme}) => {
top: -${space[2]}px;
bottom: -${space[1] + space[1]}px;
left: ${space[4] + space[1]}px;
right: 0;
right: ${space[2]}px;
background-color: ${bg};
pointer-events: none;
`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ export const ChangeIndicatorWrapper = styled.div<{$hasChanges: boolean}>(
top: 0;
bottom: 0;
padding-left: ${space[1]}px;
padding-right: ${space[3]}px;
user-select: none;
${!$hasChanges &&
Expand Down

0 comments on commit 63dd0ff

Please sign in to comment.