File tree Expand file tree Collapse file tree 2 files changed +29
-4
lines changed
Expand file tree Collapse file tree 2 files changed +29
-4
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ const Docs: React.FC<PropTypes> = props => {
3030
3131 // viewer props
3232 const [ indent , setIndent ] = React . useState ( 4 ) ;
33+ const [ lineNumbers , setLineNumbers ] = React . useState ( true ) ;
3334 const [ highlightInlineDiff , setHighlightInlineDiff ] = React . useState ( true ) ;
3435 const [ inlineDiffMode , setInlineDiffMode ] = React . useState < InlineDiffOptions [ 'mode' ] > ( 'word' ) ;
3536 const [ inlineDiffSeparator , setInlineDiffSeparator ] = React . useState ( ' ' ) ;
@@ -45,7 +46,7 @@ const Docs: React.FC<PropTypes> = props => {
4546 ignoreCase,
4647 recursiveEqual,
4748 preserveKeyOrder,
48- compareKey
49+ compareKey,
4950 } ) , [
5051 detectCircular ,
5152 maxDepth ,
@@ -143,8 +144,8 @@ const Docs: React.FC<PropTypes> = props => {
143144 } ;
144145
145146 const viewerCommonProps : Partial < ViewerProps > = {
146- indent : indent ,
147- lineNumbers : true ,
147+ indent,
148+ lineNumbers,
148149 highlightInlineDiff,
149150 inlineDiffOptions : {
150151 mode : inlineDiffMode ,
@@ -288,6 +289,16 @@ const Docs: React.FC<PropTypes> = props => {
288289 />
289290 </ label >
290291 < blockquote > Controls the indent in the < code > <Viewer></ code > component.</ blockquote >
292+ < label htmlFor = "line-numbers" >
293+ Line numbers:
294+ < input
295+ type = "checkbox"
296+ id = "line-numbers"
297+ checked = { lineNumbers }
298+ onChange = { e => setLineNumbers ( e . target . checked ) }
299+ />
300+ </ label >
301+ < blockquote > Whether to show line numbers.</ blockquote >
291302 < label htmlFor = "highlight-inline-diff" >
292303 Highlight inline diff:
293304 < input
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ const Playground: React.FC<PlaygroundProps> = props => {
3232
3333 // viewer props
3434 const [ indent , setIndent ] = React . useState ( 4 ) ;
35+ const [ lineNumbers , setLineNumbers ] = React . useState ( true ) ;
3536 const [ highlightInlineDiff , setHighlightInlineDiff ] = React . useState ( true ) ;
3637 const [ inlineDiffMode , setInlineDiffMode ] = React . useState < InlineDiffOptions [ 'mode' ] > ( 'word' ) ;
3738 const [ inlineDiffSeparator , setInlineDiffSeparator ] = React . useState ( ' ' ) ;
@@ -93,14 +94,15 @@ const Playground: React.FC<PlaygroundProps> = props => {
9394 } , [ virtual ] ) ;
9495 const viewerOptions : Omit < ViewerProps , 'diff' > = React . useMemo ( ( ) => ( {
9596 indent,
96- lineNumbers : true ,
97+ lineNumbers,
9798 highlightInlineDiff,
9899 inlineDiffOptions,
99100 hideUnchangedLines,
100101 syntaxHighlight : syntaxHighlight ? { theme : 'monokai' } : false ,
101102 virtual : virtualOptions ,
102103 } ) , [
103104 indent ,
105+ lineNumbers ,
104106 highlightInlineDiff ,
105107 inlineDiffOptions ,
106108 hideUnchangedLines ,
@@ -359,6 +361,18 @@ return (
359361 onChange = { e => setIndent ( Number ( e . target . value ) ) }
360362 />
361363 </ label >
364+ < label htmlFor = "line-numbers" >
365+ < Label
366+ title = "Line numbers"
367+ tip = { < > Whether to show line numbers.</ > }
368+ />
369+ < input
370+ type = "checkbox"
371+ id = "line-numbers"
372+ checked = { lineNumbers }
373+ onChange = { e => setLineNumbers ( e . target . checked ) }
374+ />
375+ </ label >
362376 < label htmlFor = "highlight-inline-diff" >
363377 < Label
364378 title = "Highlight inline diff"
You can’t perform that action at this time.
0 commit comments