@@ -12,7 +12,6 @@ import { useCreateBlockNote } from '@blocknote/react';
12
12
import { HocuspocusProvider } from '@hocuspocus/provider' ;
13
13
import { useEffect } from 'react' ;
14
14
import { useTranslation } from 'react-i18next' ;
15
- import { css } from 'styled-components' ;
16
15
import * as Y from 'yjs' ;
17
16
18
17
import { Box , TextErrors } from '@/components' ;
@@ -23,98 +22,13 @@ import { useUploadFile } from '../hook';
23
22
import { useHeadings } from '../hook/useHeadings' ;
24
23
import useSaveDoc from '../hook/useSaveDoc' ;
25
24
import { useEditorStore } from '../stores' ;
25
+ import { cssEditor } from '../styles' ;
26
26
import { randomColor } from '../utils' ;
27
27
28
28
import { BlockNoteSuggestionMenu } from './BlockNoteSuggestionMenu' ;
29
29
import { BlockNoteToolbar } from './BlockNoteToolbar' ;
30
30
import { AlertBlock , DividerBlock , QuoteBlock } from './custom-blocks' ;
31
31
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
-
118
32
export const schema = BlockNoteSchema . create ( {
119
33
blockSpecs : {
120
34
...defaultBlockSpecs ,
0 commit comments