File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -109,6 +109,7 @@ It accepts these props for styling:
109109| Name| PropType| Description|
110110| ---| ---| ---|
111111|className|PropTypes.string|An additional class that is added to the Content Editable
112+ |ignoreTabKey|PropTypes.bool|Makes the editor ignore tab key presses so that keyboard users can tab past the editor without getting stuck
112113|style|PropTypes.object|Additional styles for the Content Editable
113114
114115This component renders a Prism.js editor underneath it and also renders all of Prism’s
Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ class Editor extends Component {
102102 if ( this . props . onKeyDown ) {
103103 this . props . onKeyDown ( evt )
104104 }
105- if ( evt . keyCode === 9 ) { // Tab Key
105+ if ( evt . keyCode === 9 && ! this . props . ignoreTabKey ) { // Tab Key
106106 document . execCommand ( 'insertHTML' , false , '	' )
107107 evt . preventDefault ( )
108108 } else if ( evt . keyCode === 13 ) { // Enter Key
Original file line number Diff line number Diff line change @@ -15,6 +15,10 @@ export function LiveEditor(props: HTMLAttributes<HTMLElement>): JSX.Element
1515export function LiveError ( props : HTMLAttributes < HTMLElement > ) : JSX . Element
1616export function LivePreview ( props : HTMLAttributes < HTMLElement > ) : JSX . Element
1717
18- export class Editor extends Component < HTMLAttributes < HTMLElement > , { } > { }
18+ export type EditorProps = HTMLAttributes < HTMLElement > & {
19+ ignoreTabKey ?: boolean ;
20+ }
21+
22+ export class Editor extends Component < EditorProps , { } > { }
1923
2024export function withLive < T > ( wrappedComponent : T ) : Component < any , { } >
You can’t perform that action at this time.
0 commit comments