File tree 4 files changed +129
-5
lines changed
4 files changed +129
-5
lines changed Original file line number Diff line number Diff line change
1
+ < html >
2
+ < head >
3
+ < title > CodeBox</ title >
4
+ < script src ="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.2.0/highlight.min.js " integrity ="sha512-TDKKr+IvoqZnPzc3l35hdjpHD0m+b2EC2SrLEgKDRWpxf2rFCxemkgvJ5kfU48ip+Y+m2XVKyOCD85ybtlZDmw== " crossorigin ="anonymous "> </ script >
5
+ < script src ="https://cdn.jsdelivr.net/npm/@editorjs/editorjs@latest "> </ script >
6
+ < script src ="../dist/index.min.js "> </ script >
7
+ < link rel ="stylesheet " href ="../dist/style.css " />
8
+ </ head >
9
+ < body >
10
+ < div id ="editorjs " style ='margin-top:50px; '> </ div >
11
+ < button onclick ="save() " style ="margin-left:50%;transform:translateX(-50%); "> Save</ button >
12
+ < script type ="text/javascript ">
13
+ const editor = new EditorJS ( {
14
+ holder : 'editorjs' ,
15
+ data : {
16
+ blocks : [ {
17
+ "type" : "paragraph" ,
18
+ "data" : {
19
+ "text" : "Hey. Meet the new Editor. On this page you can see it in action — try to edit this text. Source code of the page contains the example of connection and configuration."
20
+ }
21
+ } ]
22
+ } ,
23
+ tools : {
24
+ code : CodeBox . default
25
+ }
26
+ } ) ;
27
+
28
+ const save = ( ) => {
29
+ editor . save ( ) . then ( ( outputData ) => {
30
+ console . log ( 'Article data: ' , outputData )
31
+ } ) . catch ( ( error ) => {
32
+ console . log ( 'Saving failed: ' , error )
33
+ } ) ;
34
+ }
35
+ </ script >
36
+ </ body >
37
+ </ html >
Original file line number Diff line number Diff line change 23
23
"url" : " git+https://github.com/BomdiZane/codebox.git"
24
24
},
25
25
"scripts" : {
26
- "build" : " esbuild --bundle --outfile=\" ./dist/index.min.js\" --platform =\" browser \" --minify ./src/index.ts" ,
26
+ "build" : " esbuild --bundle --outfile=\" ./dist/index.min.js\" --global-name =\" CodeBox \" --platform= \" browser \" ./src/index.ts && cp ./src/style.css ./dist/style.css " ,
27
27
"start" : " node test.js"
28
28
},
29
29
"devDependencies" : {
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ type CodeboxConfig = {
14
14
themeURL : string ;
15
15
useDefaultTheme : string ;
16
16
languages ?: string [ ] ;
17
+ toolbarTitle ?: string ;
17
18
}
18
19
19
20
type CodeboxData = {
@@ -22,7 +23,7 @@ type CodeboxData = {
22
23
theme : string ;
23
24
}
24
25
25
- class CodeBox {
26
+ export default class CodeBox {
26
27
27
28
public api : any ;
28
29
public config : CodeboxConfig ;
@@ -213,6 +214,3 @@ class CodeBox {
213
214
return themeURL ;
214
215
}
215
216
}
216
-
217
-
218
- module . exports = CodeBox ;
Original file line number Diff line number Diff line change
1
+ .codeBoxHolder {
2
+ display : flex;
3
+ flex-direction : column;
4
+ justify-content : flex-start;
5
+ align-items : flex-start;
6
+ }
7
+
8
+ .codeBoxTextArea {
9
+ width : 100% ;
10
+ min-height : 30px ;
11
+ padding : 10px ;
12
+ border-radius : 2px 2px 2px 0 ;
13
+ border : none !important ;
14
+ outline : none !important ;
15
+ font : 14px monospace;
16
+ }
17
+
18
+ .codeBoxSelectDiv {
19
+ display : flex;
20
+ flex-direction : column;
21
+ justify-content : flex-start;
22
+ align-items : flex-start;
23
+ position : relative;
24
+ }
25
+
26
+ .codeBoxSelectInput {
27
+ border-radius : 0 0 20px 2px ;
28
+ padding : 2px 26px ;
29
+ padding-top : 0 ;
30
+ padding-right : 0 ;
31
+ text-align : left;
32
+ cursor : pointer;
33
+ border : none !important ;
34
+ outline : none !important ;
35
+ }
36
+
37
+ .codeBoxSelectDropIcon {
38
+ position : absolute !important ;
39
+ left : 10px !important ;
40
+ bottom : 0 !important ;
41
+ width : unset !important ;
42
+ height : unset !important ;
43
+ font-size : 16px !important ;
44
+ }
45
+
46
+ .codeBoxSelectPreview {
47
+ display : none;
48
+ flex-direction : column;
49
+ justify-content : flex-start;
50
+ align-items : flex-start;
51
+ border-radius : 2px ;
52
+ box-shadow : 0 3px 15px -3px rgba (13 , 20 , 33 , .13 );
53
+ position : absolute;
54
+ top : 100% ;
55
+ margin : 5px 0 ;
56
+ max-height : 30vh ;
57
+ overflow-x : hidden;
58
+ overflow-y : auto;
59
+ z-index : 10000 ;
60
+ }
61
+
62
+ .codeBoxSelectItem {
63
+ width : 100% ;
64
+ padding : 5px 20px ;
65
+ margin : 0 ;
66
+ cursor : pointer;
67
+ }
68
+
69
+ .codeBoxSelectItem : hover {
70
+ opacity : 0.7 ;
71
+ }
72
+
73
+ .codeBoxSelectedItem {
74
+ background-color : lightblue !important ;
75
+ }
76
+
77
+ .codeBoxShow {
78
+ display : flex !important ;
79
+ }
80
+
81
+ .dark {
82
+ color : # abb2bf ;
83
+ background-color : # 282c34 ;
84
+ }
85
+
86
+ .light {
87
+ color : # 383a42 ;
88
+ background-color : # fafafa ;
89
+ }
You can’t perform that action at this time.
0 commit comments