File tree Expand file tree Collapse file tree 25 files changed +662
-256
lines changed
examples/05-interoperability
01-converting-blocks-to-html/src
02-converting-blocks-from-html/src
03-converting-blocks-to-md/src
04-converting-blocks-from-md/src
05-converting-blocks-to-pdf
06-converting-blocks-to-docx
07-converting-blocks-to-odt
08-converting-blocks-to-react-email Expand file tree Collapse file tree 25 files changed +662
-256
lines changed Original file line number Diff line number Diff line change @@ -41,18 +41,22 @@ export default function App() {
41
41
// eslint-disable-next-line react-hooks/exhaustive-deps
42
42
} , [ ] ) ;
43
43
44
- // Renders the editor instance, and its contents as HTML below .
44
+ // Renders the editor instance and HTML output .
45
45
return (
46
- < div className = "wrapper" >
47
- < div > Input (BlockNote Editor):</ div >
48
- < div className = "item" >
49
- < BlockNoteView editor = { editor } onChange = { onChange } />
46
+ < div className = "views" >
47
+ < div className = "view-wrapper" >
48
+ < div className = "view-label" > Editor Input</ div >
49
+ < div className = "view" >
50
+ < BlockNoteView editor = { editor } onChange = { onChange } />
51
+ </ div >
50
52
</ div >
51
- < div > Output (HTML):</ div >
52
- < div className = "item bordered" >
53
- < pre >
54
- < code > { html } </ code >
55
- </ pre >
53
+ < div className = "view-wrapper" >
54
+ < div className = "view-label" > HTML Output</ div >
55
+ < div className = "view" >
56
+ < pre >
57
+ < code > { html } </ code >
58
+ </ pre >
59
+ </ div >
56
60
</ div >
57
61
</ div >
58
62
) ;
Original file line number Diff line number Diff line change 1
- .wrapper {
1
+ .views {
2
+ container-name : views;
3
+ container-type : inline-size;
2
4
display : flex;
3
- flex-direction : column;
5
+ flex-direction : row;
6
+ flex-wrap : wrap;
7
+ gap : 8px ;
4
8
height : 100% ;
9
+ padding : 8px ;
10
+ }
11
+
12
+ .view-wrapper {
13
+ display : flex;
14
+ flex-direction : column;
15
+ height : calc (50% - 4px );
16
+ width : 100% ;
17
+ }
18
+
19
+ @container views (width > 1024px) {
20
+ .view-wrapper {
21
+ height : 100% ;
22
+ width : calc (50% - 4px );
23
+ }
24
+ }
25
+
26
+ .view-label {
27
+ color : # 0090ff ;
28
+ display : flex;
29
+ font-size : 12px ;
30
+ font-weight : bold;
31
+ justify-content : space-between;
32
+ margin-inline : 16px ;
5
33
}
6
34
7
- .item {
8
- border-radius : 0.5rem ;
35
+ .view {
36
+ border : solid # 0090ff 1px ;
37
+ border-radius : 16px ;
9
38
flex : 1 ;
10
- overflow : hidden;
39
+ height : 0 ;
40
+ padding : 8px ;
11
41
}
12
42
13
- .item .bordered {
14
- border : 1px solid gray;
43
+ .view .bn-container {
44
+ height : 100% ;
45
+ margin : 0 ;
46
+ max-width : none;
47
+ padding : 0 ;
15
48
}
16
49
17
- .item pre {
18
- border-radius : 0.5rem ;
50
+ .view .bn-editor {
19
51
height : 100% ;
20
52
overflow : auto;
21
- padding-block : 1rem ;
22
- padding-inline : 54px ;
23
- width : 100% ;
53
+ }
54
+
55
+ .view pre {
56
+ background-color : # 0090ff20 ;
57
+ border-radius : 8px ;
58
+ flex : 1 ;
59
+ height : 100% ;
60
+ margin : 0 ;
61
+ overflow : auto;
62
+ padding : 8px ;
24
63
white-space : pre-wrap;
25
64
}
Original file line number Diff line number Diff line change @@ -31,19 +31,22 @@ export default function App() {
31
31
loadInitialHTML ( ) ;
32
32
} , [ editor ] ) ;
33
33
34
- // Renders a text area for you to write/paste HTML in, and the editor instance
35
- // below, which displays the current HTML as blocks.
34
+ // Renders the HTML input and editor instance.
36
35
return (
37
- < div className = { "wrapper" } >
38
- < div > Input (HTML):</ div >
39
- < div className = { "item bordered" } >
40
- < code >
41
- < textarea defaultValue = { initialHTML } onChange = { htmlInputChanged } />
42
- </ code >
36
+ < div className = "views" >
37
+ < div className = "view-wrapper" >
38
+ < div className = "view-label" > HTML Input</ div >
39
+ < div className = "view" >
40
+ < code >
41
+ < textarea defaultValue = { initialHTML } onChange = { htmlInputChanged } />
42
+ </ code >
43
+ </ div >
43
44
</ div >
44
- < div > Output (BlockNote Editor):</ div >
45
- < div className = { "item" } >
46
- < BlockNoteView editor = { editor } editable = { false } />
45
+ < div className = "view-wrapper" >
46
+ < div className = "view-label" > Editor Output</ div >
47
+ < div className = "view" >
48
+ < BlockNoteView editor = { editor } editable = { false } />
49
+ </ div >
47
50
</ div >
48
51
</ div >
49
52
) ;
Original file line number Diff line number Diff line change 1
- .wrapper {
1
+ .views {
2
+ container-name : views;
3
+ container-type : inline-size;
2
4
display : flex;
3
- flex-direction : column;
5
+ flex-direction : row;
6
+ flex-wrap : wrap;
7
+ gap : 8px ;
4
8
height : 100% ;
9
+ padding : 8px ;
5
10
}
6
11
7
- .item {
8
- border-radius : 0.5rem ;
12
+ .view-wrapper {
13
+ display : flex;
14
+ flex-direction : column;
15
+ height : calc (50% - 4px );
16
+ width : 100% ;
17
+ }
18
+
19
+ @container views (width > 1024px) {
20
+ .view-wrapper {
21
+ height : 100% ;
22
+ width : calc (50% - 4px );
23
+ }
24
+ }
25
+
26
+ .view-label {
27
+ color : # 0090ff ;
28
+ display : flex;
29
+ font-size : 12px ;
30
+ font-weight : bold;
31
+ justify-content : space-between;
32
+ margin-inline : 16px ;
33
+ }
34
+
35
+ .view {
36
+ border : solid # 0090ff 1px ;
37
+ border-radius : 16px ;
9
38
flex : 1 ;
10
- overflow : hidden;
39
+ height : 0 ;
40
+ padding : 8px ;
41
+ }
42
+
43
+ .view .bn-container {
44
+ height : 100% ;
45
+ margin : 0 ;
46
+ max-width : none;
47
+ padding : 0 ;
11
48
}
12
49
13
- .item .bordered {
14
- border : 1px solid gray;
50
+ .view .bn-editor {
51
+ height : 100% ;
52
+ overflow : auto;
15
53
}
16
54
17
- .item textarea {
18
- background-color : transparent;
19
- border-radius : 0.5rem ;
55
+ .view textarea {
56
+ background-color : # 0090ff20 ;
57
+ border : none;
58
+ border-radius : 8px ;
59
+ flex : 1 ;
20
60
height : 100% ;
61
+ margin : 0 ;
21
62
overflow : auto;
22
- padding-block : 1rem ;
23
- padding-inline : 54px ;
63
+ padding : 8px ;
24
64
resize : none;
65
+ white-space : pre-wrap;
25
66
width : 100% ;
26
67
}
Original file line number Diff line number Diff line change @@ -41,18 +41,22 @@ export default function App() {
41
41
// eslint-disable-next-line react-hooks/exhaustive-deps
42
42
} , [ ] ) ;
43
43
44
- // Renders the editor instance, and its contents as Markdown below .
44
+ // Renders the editor instance and Markdown output .
45
45
return (
46
- < div className = { "wrapper" } >
47
- < div > Input (BlockNote Editor):</ div >
48
- < div className = { "item" } >
49
- < BlockNoteView editor = { editor } onChange = { onChange } />
46
+ < div className = "views" >
47
+ < div className = "view-wrapper" >
48
+ < div className = "view-label" > Editor Input</ div >
49
+ < div className = "view" >
50
+ < BlockNoteView editor = { editor } onChange = { onChange } />
51
+ </ div >
50
52
</ div >
51
- < div > Output (Markdown):</ div >
52
- < div className = { "item bordered" } >
53
- < pre >
54
- < code > { markdown } </ code >
55
- </ pre >
53
+ < div className = "view-wrapper" >
54
+ < div className = "view-label" > Markdown Output</ div >
55
+ < div className = "view" >
56
+ < pre >
57
+ < code > { markdown } </ code >
58
+ </ pre >
59
+ </ div >
56
60
</ div >
57
61
</ div >
58
62
) ;
Original file line number Diff line number Diff line change 1
- .wrapper {
1
+ .views {
2
+ container-name : views;
3
+ container-type : inline-size;
2
4
display : flex;
3
- flex-direction : column;
5
+ flex-direction : row;
6
+ flex-wrap : wrap;
7
+ gap : 8px ;
4
8
height : 100% ;
9
+ padding : 8px ;
10
+ }
11
+
12
+ .view-wrapper {
13
+ display : flex;
14
+ flex-direction : column;
15
+ height : calc (50% - 4px );
16
+ width : 100% ;
17
+ }
18
+
19
+ @container views (width > 1024px) {
20
+ .view-wrapper {
21
+ height : 100% ;
22
+ width : calc (50% - 4px );
23
+ }
24
+ }
25
+
26
+ .view-label {
27
+ color : # 0090ff ;
28
+ display : flex;
29
+ font-size : 12px ;
30
+ font-weight : bold;
31
+ justify-content : space-between;
32
+ margin-inline : 16px ;
5
33
}
6
34
7
- .item {
8
- border-radius : 0.5rem ;
35
+ .view {
36
+ border : solid # 0090ff 1px ;
37
+ border-radius : 16px ;
9
38
flex : 1 ;
10
- overflow : hidden;
39
+ height : 0 ;
40
+ padding : 8px ;
11
41
}
12
42
13
- .item .bordered {
14
- border : 1px solid gray;
43
+ .view .bn-container {
44
+ height : 100% ;
45
+ margin : 0 ;
46
+ max-width : none;
47
+ padding : 0 ;
15
48
}
16
49
17
- .item pre {
18
- border-radius : 0.5rem ;
50
+ .view .bn-editor {
19
51
height : 100% ;
20
52
overflow : auto;
21
- padding-block : 1rem ;
22
- padding-inline : 54px ;
23
- width : 100% ;
53
+ }
54
+
55
+ .view pre {
56
+ background-color : # 0090ff20 ;
57
+ border-radius : 8px ;
58
+ flex : 1 ;
59
+ height : 100% ;
60
+ margin : 0 ;
61
+ overflow : auto;
62
+ padding : 8px ;
24
63
white-space : pre-wrap;
25
64
}
Original file line number Diff line number Diff line change @@ -31,22 +31,25 @@ export default function App() {
31
31
loadInitialHTML ( ) ;
32
32
} , [ editor ] ) ;
33
33
34
- // Renders a text area for you to write/paste Markdown in, and the editor instance
35
- // below, which displays the current Markdown as blocks.
34
+ // Renders the Markdown input and editor instance.
36
35
return (
37
- < div className = { "wrapper" } >
38
- < div > Input (Markdown):</ div >
39
- < div className = { "item bordered" } >
40
- < code >
41
- < textarea
42
- defaultValue = { initialMarkdown }
43
- onChange = { markdownInputChanged }
44
- />
45
- </ code >
36
+ < div className = "views" >
37
+ < div className = "view-wrapper" >
38
+ < div className = "view-label" > Markdown Input</ div >
39
+ < div className = "view" >
40
+ < code >
41
+ < textarea
42
+ defaultValue = { initialMarkdown }
43
+ onChange = { markdownInputChanged }
44
+ />
45
+ </ code >
46
+ </ div >
46
47
</ div >
47
- < div > Output (BlockNote Editor):</ div >
48
- < div className = { "item" } >
49
- < BlockNoteView editor = { editor } editable = { false } />
48
+ < div className = "view-wrapper" >
49
+ < div className = "view-label" > Editor Output</ div >
50
+ < div className = "view" >
51
+ < BlockNoteView editor = { editor } editable = { false } />
52
+ </ div >
50
53
</ div >
51
54
</ div >
52
55
) ;
You can’t perform that action at this time.
0 commit comments