@@ -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,107 +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 = 'alert' ] {
39
- height : 55px ;
40
- }
41
- .bn-side-menu [data-block-type = 'divider' ] {
42
- height : 40px ;
43
- }
44
- .bn-side-menu [data-block-type = 'quote' ] {
45
- height : 46px ;
46
- }
47
- .bn-side-menu [data-block-type = 'heading' ][data-level = '1' ] {
48
- height : 50px ;
49
- }
50
- .bn-side-menu [data-block-type = 'heading' ][data-level = '2' ] {
51
- height : 43px ;
52
- }
53
- .bn-side-menu [data-block-type = 'heading' ][data-level = '3' ] {
54
- height : 35px ;
55
- }
56
- h1 {
57
- font-size : 1.875rem ;
58
- }
59
- h2 {
60
- font-size : 1.5rem ;
61
- }
62
- h3 {
63
- font-size : 1.25rem ;
64
- }
65
- a {
66
- color : var (--c--theme--colors--greyscale-500 );
67
- cursor : pointer;
68
- }
69
- .bn-block-group
70
- .bn-block-group
71
- .bn-block-outer : not ([data-prev-depth-changed ]): before {
72
- border-left : none;
73
- }
74
- }
75
-
76
- .bn-editor {
77
- color : var (--c--theme--colors--greyscale-700 );
78
- }
79
-
80
- .bn-block-outer : not (: first-child ) {
81
- & : has (h1 ) {
82
- padding-top : 32px ;
83
- }
84
- & : has (h2 ) {
85
- padding-top : 24px ;
86
- }
87
- & : has (h3 ) {
88
- padding-top : 16px ;
89
- }
90
- }
91
-
92
- & .bn-inline-content code {
93
- background-color : gainsboro;
94
- padding : 2px ;
95
- border-radius : 4px ;
96
- }
97
-
98
- @media screen and (width <= 560px) {
99
- & .bn-editor {
100
- ${ readonly && `padding-left: 10px;` }
101
- }
102
- .bn-side-menu [data-block-type = 'heading' ][data-level = '1' ] {
103
- height : 46px ;
104
- }
105
- .bn-side-menu [data-block-type = 'heading' ][data-level = '2' ] {
106
- height : 40px ;
107
- }
108
- .bn-side-menu [data-block-type = 'heading' ][data-level = '3' ] {
109
- height : 40px ;
110
- }
111
- & .bn-editor h1 {
112
- font-size : 1.6rem ;
113
- }
114
- & .bn-editor h2 {
115
- font-size : 1.35rem ;
116
- }
117
- & .bn-editor h3 {
118
- font-size : 1.2rem ;
119
- }
120
- .bn-block-content [data-is-empty-and-focused ][data-content-type = 'paragraph' ]
121
- .bn-inline-content : has (> .ProseMirror-trailingBreak : only-child )::before {
122
- font-size : 14px ;
123
- }
124
- }
125
- ` ;
126
-
127
32
export const schema = BlockNoteSchema . create ( {
128
33
blockSpecs : {
129
34
...defaultBlockSpecs ,
0 commit comments