Skip to content

Commit fa76faa

Browse files
committed
🚚(frontend) move Blocknote styles
Move Blocknote styles to separate file.
1 parent f5ba6e6 commit fa76faa

File tree

2 files changed

+88
-87
lines changed

2 files changed

+88
-87
lines changed

src/frontend/apps/impress/src/features/docs/doc-editor/components/BlockNoteEditor.tsx

Lines changed: 1 addition & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import { useCreateBlockNote } from '@blocknote/react';
1212
import { HocuspocusProvider } from '@hocuspocus/provider';
1313
import { useEffect } from 'react';
1414
import { useTranslation } from 'react-i18next';
15-
import { css } from 'styled-components';
1615
import * as Y from 'yjs';
1716

1817
import { Box, TextErrors } from '@/components';
@@ -23,98 +22,13 @@ import { useUploadFile } from '../hook';
2322
import { useHeadings } from '../hook/useHeadings';
2423
import useSaveDoc from '../hook/useSaveDoc';
2524
import { useEditorStore } from '../stores';
25+
import { cssEditor } from '../styles';
2626
import { randomColor } from '../utils';
2727

2828
import { BlockNoteSuggestionMenu } from './BlockNoteSuggestionMenu';
2929
import { BlockNoteToolbar } from './BlockNoteToolbar';
3030
import { AlertBlock, DividerBlock, QuoteBlock } from './custom-blocks';
3131

32-
const cssEditor = (readonly: boolean) => css`
33-
&,
34-
& > .bn-container,
35-
& .ProseMirror {
36-
height: 100%;
37-
38-
.bn-side-menu[data-block-type='heading'][data-level='1'] {
39-
height: 50px;
40-
}
41-
.bn-side-menu[data-block-type='heading'][data-level='2'] {
42-
height: 43px;
43-
}
44-
.bn-side-menu[data-block-type='heading'][data-level='3'] {
45-
height: 35px;
46-
}
47-
h1 {
48-
font-size: 1.875rem;
49-
}
50-
h2 {
51-
font-size: 1.5rem;
52-
}
53-
h3 {
54-
font-size: 1.25rem;
55-
}
56-
a {
57-
color: var(--c--theme--colors--greyscale-500);
58-
cursor: pointer;
59-
}
60-
.bn-block-group
61-
.bn-block-group
62-
.bn-block-outer:not([data-prev-depth-changed]):before {
63-
border-left: none;
64-
}
65-
}
66-
67-
.bn-editor {
68-
color: var(--c--theme--colors--greyscale-700);
69-
}
70-
71-
.bn-block-outer:not(:first-child) {
72-
&:has(h1) {
73-
padding-top: 32px;
74-
}
75-
&:has(h2) {
76-
padding-top: 24px;
77-
}
78-
&:has(h3) {
79-
padding-top: 16px;
80-
}
81-
}
82-
83-
& .bn-inline-content code {
84-
background-color: gainsboro;
85-
padding: 2px;
86-
border-radius: 4px;
87-
}
88-
89-
@media screen and (width <= 560px) {
90-
& .bn-editor {
91-
${readonly && `padding-left: 10px;`}
92-
}
93-
.bn-side-menu[data-block-type='heading'][data-level='1'] {
94-
height: 46px;
95-
}
96-
.bn-side-menu[data-block-type='heading'][data-level='2'] {
97-
height: 40px;
98-
}
99-
.bn-side-menu[data-block-type='heading'][data-level='3'] {
100-
height: 40px;
101-
}
102-
& .bn-editor h1 {
103-
font-size: 1.6rem;
104-
}
105-
& .bn-editor h2 {
106-
font-size: 1.35rem;
107-
}
108-
& .bn-editor h3 {
109-
font-size: 1.2rem;
110-
}
111-
.bn-block-content[data-is-empty-and-focused][data-content-type='paragraph']
112-
.bn-inline-content:has(> .ProseMirror-trailingBreak:only-child)::before {
113-
font-size: 14px;
114-
}
115-
}
116-
`;
117-
11832
export const schema = BlockNoteSchema.create({
11933
blockSpecs: {
12034
...defaultBlockSpecs,
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
import { css } from 'styled-components';
2+
3+
export const cssEditor = (readonly: boolean) => css`
4+
&,
5+
& > .bn-container,
6+
& .ProseMirror {
7+
height: 100%;
8+
9+
.bn-side-menu[data-block-type='heading'][data-level='1'] {
10+
height: 50px;
11+
}
12+
.bn-side-menu[data-block-type='heading'][data-level='2'] {
13+
height: 43px;
14+
}
15+
.bn-side-menu[data-block-type='heading'][data-level='3'] {
16+
height: 35px;
17+
}
18+
h1 {
19+
font-size: 1.875rem;
20+
}
21+
h2 {
22+
font-size: 1.5rem;
23+
}
24+
h3 {
25+
font-size: 1.25rem;
26+
}
27+
a {
28+
color: var(--c--theme--colors--greyscale-500);
29+
cursor: pointer;
30+
}
31+
.bn-block-group
32+
.bn-block-group
33+
.bn-block-outer:not([data-prev-depth-changed]):before {
34+
border-left: none;
35+
}
36+
}
37+
38+
.bn-editor {
39+
color: var(--c--theme--colors--greyscale-700);
40+
}
41+
42+
.bn-block-outer:not(:first-child) {
43+
&:has(h1) {
44+
padding-top: 32px;
45+
}
46+
&:has(h2) {
47+
padding-top: 24px;
48+
}
49+
&:has(h3) {
50+
padding-top: 16px;
51+
}
52+
}
53+
54+
& .bn-inline-content code {
55+
background-color: gainsboro;
56+
padding: 2px;
57+
border-radius: 4px;
58+
}
59+
60+
@media screen and (width <= 560px) {
61+
& .bn-editor {
62+
${readonly && `padding-left: 10px;`}
63+
}
64+
.bn-side-menu[data-block-type='heading'][data-level='1'] {
65+
height: 46px;
66+
}
67+
.bn-side-menu[data-block-type='heading'][data-level='2'] {
68+
height: 40px;
69+
}
70+
.bn-side-menu[data-block-type='heading'][data-level='3'] {
71+
height: 40px;
72+
}
73+
& .bn-editor h1 {
74+
font-size: 1.6rem;
75+
}
76+
& .bn-editor h2 {
77+
font-size: 1.35rem;
78+
}
79+
& .bn-editor h3 {
80+
font-size: 1.2rem;
81+
}
82+
.bn-block-content[data-is-empty-and-focused][data-content-type='paragraph']
83+
.bn-inline-content:has(> .ProseMirror-trailingBreak:only-child)::before {
84+
font-size: 14px;
85+
}
86+
}
87+
`;

0 commit comments

Comments
 (0)