Skip to content

Commit 6b4c7e6

Browse files
committed
Force rerender on image load to recalculate caption visibility
1 parent d1fc851 commit 6b4c7e6

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

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

89
# 5.11.0 - 15.11.2024
910

uui-editor/src/plugins/imagePlugin/ImageElement.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { Resizable, ResizeHandle } from '../../implementation/Resizable';
1515
import { PlateImgAlign, TImageElement } from './types';
1616
import { Caption, CaptionTextarea } from '@udecode/plate-caption';
1717
import { ResizableProvider } from '@udecode/plate-resizable';
18+
import { useForceUpdate } from '@epam/uui-core';
1819

1920
interface ImageElementProps extends PlateElementProps<Value, TImageElement> {
2021
align?: PlateImgAlign;
@@ -28,6 +29,7 @@ export const ImageElement = withHOC(ResizableProvider, ({
2829
align,
2930
...props
3031
}: ImageElementProps) => {
32+
const forceUpdate = useForceUpdate();
3133
const { children, nodeProps } = props;
3234

3335
const focused = useFocused();
@@ -80,6 +82,7 @@ export const ImageElement = withHOC(ResizableProvider, ({
8082
visible && css.selectedImage, // for mobile
8183
nodeProps?.className,
8284
) }
85+
onLoad={() => forceUpdate()}
8386
/>
8487
{!readOnly && (
8588
<ResizeHandle

0 commit comments

Comments
 (0)