Skip to content

Commit e673c82

Browse files
Fixed selection handling clicking editor padding (#1629)
1 parent f76ef4c commit e673c82

File tree

4 files changed

+13
-14
lines changed

4 files changed

+13
-14
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
[data-content-type="pdf"] .bn-file-block-content-wrapper,
2-
[data-content-type="pdf"] .bn-file-and-caption-wrapper {
3-
height: 800px;
4-
width: 100%;
5-
}
6-
71
[data-content-type="pdf"] embed {
8-
height: 100%;
2+
height: 800px;
93
width: 100%;
104
}

packages/core/src/blocks/FileBlockContent/helpers/render/createResizableFileBlockWrapper.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,10 @@ export const createResizableFileBlockWrapper = (
8787

8888
// Ensures the element is not wider than the editor and not narrower than a
8989
// predetermined minimum width.
90-
width = Math.max(newWidth, minWidth);
90+
width = Math.min(
91+
Math.max(newWidth, minWidth),
92+
editor.domElement?.firstElementChild?.clientWidth || Number.MAX_VALUE
93+
);
9194
wrapper.style.width = `${width}px`;
9295
};
9396
// Stops mouse movements from resizing the element and updates the block's

packages/core/src/editor/Block.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ BASIC STYLES
1414
}
1515

1616
.bn-block-content {
17-
display: flex;
1817
padding: 3px 0;
1918
transition: font-size 0.2s;
2019
width: 100%;
@@ -163,6 +162,7 @@ NESTED BLOCKS
163162
.bn-block-content::before {
164163
margin-right: 0;
165164
content: "";
165+
display: inline;
166166
}
167167

168168
/* Ordered */

packages/react/src/blocks/FileBlockContent/helpers/render/ResizableFileBlockWrapper.tsx

+7-5
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,13 @@ export const ResizableFileBlockWrapper = (
6666

6767
// Ensures the child is not wider than the editor and not narrower than a
6868
// predetermined minimum width.
69-
if (newWidth < minWidth) {
70-
setWidth(minWidth);
71-
} else {
72-
setWidth(newWidth);
73-
}
69+
setWidth(
70+
Math.min(
71+
Math.max(newWidth, minWidth),
72+
props.editor.domElement?.firstElementChild?.clientWidth ||
73+
Number.MAX_VALUE
74+
)
75+
);
7476
};
7577
// Stops mouse movements from resizing the child and updates the block's
7678
// `width` prop to the new value.

0 commit comments

Comments
 (0)