Skip to content

Commit da0c7e6

Browse files
authored
Blocknote editor fix (#11823)
After reading the blocknote documentation : - we decided to increase to 100% the lines width - we decided to reduce as much as possible inner padding - we decided it's on the parent to decide the padding of the richtext The two last points are recommended in a discussion on the project blocknote. This way clicking on padding won't trigger weird behaviour on Chrome. Fixes twentyhq/core-team-issues#827 (comment)
1 parent a9e73c6 commit da0c7e6

File tree

4 files changed

+18
-5
lines changed

4 files changed

+18
-5
lines changed

packages/twenty-front/src/modules/command-menu/pages/rich-text-page/components/CommandMenuEditRichTextPage.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ import { useRecoilValue } from 'recoil';
55
import { viewableRichTextComponentState } from '../states/viewableRichTextComponentState';
66

77
const StyledContainer = styled.div`
8+
box-sizing: border-box;
89
margin: ${({ theme }) => theme.spacing(4)} ${({ theme }) => theme.spacing(-2)};
10+
padding-inline: 44px 0px;
11+
width: 100%;
912
`;
1013

1114
export const CommandMenuEditRichTextPage = () => {

packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/RichTextFieldInput.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,12 @@ export type RichTextFieldInputProps = {
2323
const StyledContainer = styled.div`
2424
background-color: ${({ theme }) => theme.background.primary};
2525
width: 480px;
26-
padding: ${({ theme }) => theme.spacing(2)};
27-
margin: 0 0 0 ${({ theme }) => theme.spacing(-6)};
26+
padding: ${({ theme }) => theme.spacing(2)} ${({ theme }) => theme.spacing(2)}
27+
${({ theme }) => theme.spacing(2)} ${({ theme }) => theme.spacing(12)};
28+
margin: 0 0 0 ${({ theme }) => theme.spacing(-5)};
2829
display: flex;
30+
box-sizing: border-box;
31+
position: relative;
2932
`;
3033

3134
const StyledCollapseButton = styled.div`

packages/twenty-front/src/modules/ui/input/editor/components/BlockEditor.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ const StyledEditor = styled.div`
4444
width: 20px;
4545
background: transparent;
4646
}
47-
& .bn-editor {
48-
padding-inline: 44px;
49-
}
5047
& .bn-container .bn-drag-handle {
5148
width: 20px;
5249
height: 20px;
@@ -69,6 +66,14 @@ const StyledEditor = styled.div`
6966
left: 26px;
7067
}
7168
69+
& .bn-editor {
70+
padding-inline: 0px;
71+
}
72+
73+
& .bn-inline-content {
74+
width: 100%;
75+
}
76+
7277
& .bn-container .bn-suggestion-menu-item:hover {
7378
background-color: blue;
7479
}

packages/twenty-front/src/modules/ui/layout/show-page/components/ShowPageActivityContainer.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ const ActivityRichTextEditor = lazy(() =>
1919
const StyledShowPageActivityContainer = styled.div`
2020
margin-top: ${({ theme }) => theme.spacing(6)};
2121
width: 100%;
22+
padding-inline: 44px;
23+
box-sizing: border-box;
2224
`;
2325

2426
const StyledSkeletonContainer = styled.div`

0 commit comments

Comments
 (0)