@@ -7,10 +7,12 @@ type Options = {
77 container ?: HTMLDivElement | null ;
88 containerEditor ?: HTMLDivElement | null ;
99 editor ?: CodeMirror . Editor ;
10- }
10+ } ;
1111
12- const Preview : React . FC < { command : ICommand , editorProps : IMarkdownEditor & Options } > = ( props ) => {
13- const { editorProps : { preview, containerEditor } } = props ;
12+ const Preview : React . FC < { command : ICommand ; editorProps : IMarkdownEditor & Options } > = ( props ) => {
13+ const {
14+ editorProps : { preview, containerEditor } ,
15+ } = props ;
1416 const [ visible , setVisible ] = useState ( props . editorProps . visible ) ;
1517 useEffect ( ( ) => {
1618 setVisible ( props . editorProps . visible ) ;
@@ -23,40 +25,39 @@ const Preview: React.FC<{ command: ICommand, editorProps: IMarkdownEditor & Opti
2325 if ( preview && visible ) {
2426 preview . style . width = '50%' ;
2527 preview . style . overflow = 'auto' ;
26- preview . style . borderLeft = '1px solid #dfdfe0 ' ;
28+ preview . style . borderLeft = '1px solid var(--color-border-muted) ' ;
2729 preview . style . padding = '20px' ;
2830 if ( containerEditor ) {
29- containerEditor . style . width = '50%'
31+ containerEditor . style . width = '50%' ;
3032 }
3133 } else if ( preview ) {
3234 preview . style . width = '0%' ;
3335 preview . style . overflow = 'hidden' ;
3436 preview . style . borderLeft = '0px' ;
3537 preview . style . padding = '0' ;
3638 if ( containerEditor ) {
37- containerEditor . style . width = '100%'
39+ containerEditor . style . width = '100%' ;
3840 }
3941 }
4042 } , [ preview , containerEditor , visible ] ) ;
4143
4244 return (
43- < button
44- onClick = { ( ) => setVisible ( ! visible ) }
45- type = "button"
46- className = { visible ? 'active' : '' }
47- >
45+ < button onClick = { ( ) => setVisible ( ! visible ) } type = "button" className = { visible ? 'active' : '' } >
4846 { props . command . icon }
4947 </ button >
50- )
51- }
48+ ) ;
49+ } ;
5250
5351export const preview : ICommand = {
5452 name : 'preview' ,
5553 keyCommand : 'preview' ,
5654 button : ( command , props , opts ) => < Preview command = { command } editorProps = { { ...props , ...opts } } /> ,
5755 icon : (
5856 < svg width = "16" height = "16" viewBox = "0 0 32 32" >
59- < path fill = "currentColor" d = "M0 16c3.037-5.864 9.058-9.802 16-9.802s12.963 3.938 15.953 9.703l0.047 0.1c-3.037 5.864-9.058 9.802-16 9.802s-12.963-3.938-15.953-9.703l-0.047-0.1zM16 22.531c3.607 0 6.531-2.924 6.531-6.531s-2.924-6.531-6.531-6.531v0c-3.607 0-6.531 2.924-6.531 6.531s2.924 6.531 6.531 6.531v0zM16 19.265c-1.804 0-3.265-1.461-3.265-3.265s1.461-3.265 3.265-3.265v0c1.804 0 3.265 1.461 3.265 3.265s-1.461 3.265-3.265 3.265v0z" />
57+ < path
58+ fill = "currentColor"
59+ d = "M0 16c3.037-5.864 9.058-9.802 16-9.802s12.963 3.938 15.953 9.703l0.047 0.1c-3.037 5.864-9.058 9.802-16 9.802s-12.963-3.938-15.953-9.703l-0.047-0.1zM16 22.531c3.607 0 6.531-2.924 6.531-6.531s-2.924-6.531-6.531-6.531v0c-3.607 0-6.531 2.924-6.531 6.531s2.924 6.531 6.531 6.531v0zM16 19.265c-1.804 0-3.265-1.461-3.265-3.265s1.461-3.265 3.265-3.265v0c1.804 0 3.265 1.461 3.265 3.265s-1.461 3.265-3.265 3.265v0z"
60+ />
6061 </ svg >
6162 ) ,
62- } ;
63+ } ;
0 commit comments