@@ -65,40 +65,13 @@ const isWindows = 'navigator' in global && /Win/i.test(navigator.platform);
6565const isMacLike =
6666 'navigator' in global && / ( M a c | i P h o n e | i P o d | i P a d ) / i. test ( navigator . platform ) ;
6767
68- const container = 'npm__react-simple-code-editor__container ' ;
68+ const className = 'npm__react-simple-code-editor__textarea ' ;
6969
7070const cssText = /* CSS */ `
71- /**
72- * Make sure that layout related properties cannot be set on the children
73- * They will likely break the editor when set. The user can always use !important to force override.
74- */
75- .${ container } > pre * {
76- display: inline;
77- font-family: inherit;
78- font-size: inherit;
79- font-style: inherit;
80- font-variant-ligatures: inherit;
81- font-weight: inherit;
82- letter-spacing: inherit;
83- line-height: inherit;
84- margin-top: 0;
85- margin-right: 0;
86- margin-bottom: 0;
87- margin-left: 0;
88- padding-top: 0;
89- padding-right: 0;
90- padding-bottom: 0;
91- padding-left: 0;
92- border-top: 0;
93- border-right: 0;
94- border-bottom: 0;
95- border-left: 0;
96- }
97-
9871/**
9972 * Reset the text fill color so that placeholder is visible
10073 */
101- .${ container } > textarea :empty {
74+ .${ className } :empty {
10275 -webkit-text-fill-color: inherit !important;
10376}
10477
@@ -111,11 +84,11 @@ const cssText = /* CSS */ `
11184 * So we use 'color: transparent' to make the text transparent on IE
11285 * Unlike other browsers, it doesn't affect caret color in IE
11386 */
114- .${ container } > textarea {
87+ .${ className } {
11588 color: transparent !important;
11689 }
11790
118- .${ container } > textarea ::selection {
91+ .${ className } ::selection {
11992 background-color: #accef7 !important;
12093 color: transparent !important;
12194 }
@@ -525,7 +498,6 @@ export default class Editor extends React.Component<Props, State> {
525498 const {
526499 value,
527500 style,
528- className,
529501 padding,
530502 highlight,
531503 textareaId,
@@ -562,18 +534,15 @@ export default class Editor extends React.Component<Props, State> {
562534 const highlighted = highlight ( value ) ;
563535
564536 return (
565- < div
566- { ...rest }
567- style = { { ...styles . container , ...style } }
568- className = { `${ container } ${ className || '' } ` }
569- >
537+ < div { ...rest } style = { { ...styles . container , ...style } } >
570538 < textarea
571539 ref = { c => ( this . _input = c ) }
572540 style = { {
573541 ...styles . editor ,
574542 ...styles . textarea ,
575543 ...contentStyle ,
576544 } }
545+ className = { className }
577546 id = { textareaId }
578547 value = { value }
579548 onChange = { this . _handleChange }
@@ -637,14 +606,8 @@ const styles = {
637606 pointerEvents : 'none' ,
638607 } ,
639608 editor : {
640- marginTop : 0 ,
641- marginRight : 0 ,
642- marginBottom : 0 ,
643- marginLeft : 0 ,
644- borderTop : 0 ,
645- borderRight : 0 ,
646- borderBottom : 0 ,
647- borderLeft : 0 ,
609+ margin : 0 ,
610+ border : 0 ,
648611 background : 'none' ,
649612 boxSizing : 'inherit' ,
650613 display : 'inherit' ,
0 commit comments