fix: Full-width images in editor are incorrectly aligned in RTL documents

closes #4712
This commit is contained in:
Tom Moor
2023-01-14 21:47:33 -05:00
parent 51baba8fa8
commit a25372c186
2 changed files with 13 additions and 7 deletions

View File

@@ -295,6 +295,7 @@ li {
max-width: 100vw;
clear: both;
position: initial;
${props.rtl ? `margin-right: var(--offset)` : `margin-left: var(--offset)`};
img {
max-width: 100vw;

View File

@@ -726,17 +726,22 @@ const ImageComponent = (
: { width: size.width || "auto" };
return (
<div contentEditable={false} className={className}>
<div
contentEditable={false}
className={className}
style={
isFullWidth
? ({
"--offset": `${-(contentWidth - documentWidth) / 2}px`,
} as React.CSSProperties)
: undefined
}
>
<ImageWrapper
isFullWidth={isFullWidth}
className={isSelected || dragging ? "ProseMirror-selectednode" : ""}
onClick={dragging ? undefined : props.onClick}
style={{
...style,
...(isFullWidth
? { marginLeft: -(contentWidth - documentWidth) / 2 }
: {}),
}}
style={style}
>
{!dragging && size.width > 60 && size.height > 60 && (
<Button onClick={props.onDownload}>