Skip to content

Commit

Permalink
Merge pull request #2652 from cpoftea/fix/image-caption-at-initial-ro…
Browse files Browse the repository at this point in the history
…-view

Force rerender on image load to recalculate caption visibility
  • Loading branch information
AlekseyManetov authored Nov 21, 2024
2 parents d1fc851 + 14ab0d1 commit 91b9eed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

**What's Fixed**
* [PickerInput]: fixed unnecessary api calls on body open with `minCharsToSearch` prop and search in body.
* [RTE]: fixed image caption not being visible when RTE initially in readonly mode

# 5.11.0 - 15.11.2024

Expand Down
3 changes: 3 additions & 0 deletions uui-editor/src/plugins/imagePlugin/ImageElement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { Resizable, ResizeHandle } from '../../implementation/Resizable';
import { PlateImgAlign, TImageElement } from './types';
import { Caption, CaptionTextarea } from '@udecode/plate-caption';
import { ResizableProvider } from '@udecode/plate-resizable';
import { useForceUpdate } from '@epam/uui-core';

interface ImageElementProps extends PlateElementProps<Value, TImageElement> {
align?: PlateImgAlign;
Expand All @@ -28,6 +29,7 @@ export const ImageElement = withHOC(ResizableProvider, ({
align,
...props
}: ImageElementProps) => {
const forceUpdate = useForceUpdate();
const { children, nodeProps } = props;

const focused = useFocused();
Expand Down Expand Up @@ -80,6 +82,7 @@ export const ImageElement = withHOC(ResizableProvider, ({
visible && css.selectedImage, // for mobile
nodeProps?.className,
) }
onLoad={ () => forceUpdate() }
/>
{!readOnly && (
<ResizeHandle
Expand Down

0 comments on commit 91b9eed

Please sign in to comment.