zhangchao 4 years ago
parent
commit
888a3a2c93
1 changed files with 23 additions and 20 deletions
  1. 23
    20
      src/RichTextEditor.js

+ 23
- 20
src/RichTextEditor.js View File

148
           this.setContentHTML(this.props.initialContentHTML || '');
148
           this.setContentHTML(this.props.initialContentHTML || '');
149
           !this.props.hiddenTitle && this.showTitle();
149
           !this.props.hiddenTitle && this.showTitle();
150
           this.props.enableOnChange && this.enableOnChange();
150
           this.props.enableOnChange && this.enableOnChange();
151
-          
151
+
152
           this.props.editorInitializedCallback && this.props.editorInitializedCallback();
152
           this.props.editorInitializedCallback && this.props.editorInitializedCallback();
153
 
153
 
154
           break;
154
           break;
221
               <Text style={[styles.inputTitle ,{marginTop: 10}]}>{linkOption.urlText}</Text>
221
               <Text style={[styles.inputTitle ,{marginTop: 10}]}>{linkOption.urlText}</Text>
222
               <View style={styles.inputWrapper}>
222
               <View style={styles.inputWrapper}>
223
                 <TextInput
223
                 <TextInput
224
-                    style={styles.input}
225
-                    onChangeText={(text) => this.setState({linkUrl: text})}
226
-                    value={this.state.linkUrl}
227
-                    keyboardType="url"
228
-                    autoCapitalize="none"
229
-                    autoCorrect={false}
224
+                  style={styles.input}
225
+                  onChangeText={(text) => this.setState({linkUrl: text})}
226
+                  value={this.state.linkUrl}
227
+                  keyboardType="url"
228
+                  autoCapitalize="none"
229
+                  autoCorrect={false}
230
                 />
230
                 />
231
               </View>
231
               </View>
232
-              {PlatformIOS && <View style={styles.lineSeparator}/>}
232
+              <View style={styles.lineSeparator}/>
233
               {this._renderModalButtons()}
233
               {this._renderModalButtons()}
234
             </View>
234
             </View>
235
           </View>
235
           </View>
248
 
248
 
249
   _renderModalButtons() {
249
   _renderModalButtons() {
250
     const insertUpdateDisabled = this.state.linkTitle.trim().length <= 0 || this.state.linkUrl.trim().length <= 0;
250
     const insertUpdateDisabled = this.state.linkTitle.trim().length <= 0 || this.state.linkUrl.trim().length <= 0;
251
-    const containerPlatformStyle = PlatformIOS ? {justifyContent: 'space-between'} : {paddingTop: 15};
252
-    const buttonPlatformStyle = PlatformIOS ? {flex: 1, height: 45, justifyContent: 'center'} : {};
251
+    const containerPlatformStyle = {justifyContent: 'space-between'};
252
+    const buttonPlatformStyle = {flex: 1, height: 45, justifyContent: 'center'};
253
     const { linkOption } = this.props;
253
     const { linkOption } = this.props;
254
     return (
254
     return (
255
-      <View style={[{alignSelf: 'stretch', flexDirection: 'row'}, containerPlatformStyle]}>
256
-        {!PlatformIOS && <View style={{flex: 1}}/>}
255
+      <View style={{alignSelf: 'stretch', flexDirection: 'row', justifyContent: 'space-between'}}>
257
         <TouchableOpacity
256
         <TouchableOpacity
258
             onPress={() => this._hideModal()}
257
             onPress={() => this._hideModal()}
259
             style={buttonPlatformStyle}
258
             style={buttonPlatformStyle}
467
   deleteEmoji(url) {
466
   deleteEmoji(url) {
468
     this._sendAction(actions.deleteEmoji, url);
467
     this._sendAction(actions.deleteEmoji, url);
469
   }
468
   }
470
-  
469
+
471
   setSubscript() {
470
   setSubscript() {
472
     this._sendAction(actions.setSubscript);
471
     this._sendAction(actions.setSubscript);
473
   }
472
   }
614
   setOnChangeEmptyOrNot(callbackHandler) {
613
   setOnChangeEmptyOrNot(callbackHandler) {
615
     this.onChangeEmptyOrNot = callbackHandler;
614
     this.onChangeEmptyOrNot = callbackHandler;
616
     this._sendAction(actions.setOnChangeEmptyOrNot);
615
     this._sendAction(actions.setOnChangeEmptyOrNot);
617
-  }
616
+  } 
618
 
617
 
619
   addSelectedTextChangeListener(listener) {
618
   addSelectedTextChangeListener(listener) {
620
     this._selectedTextChangeListeners.push(listener);
619
     this._selectedTextChangeListeners.push(listener);
631
   innerModal: {
630
   innerModal: {
632
     backgroundColor: 'rgba(255, 255, 255, 0.9)',
631
     backgroundColor: 'rgba(255, 255, 255, 0.9)',
633
     paddingTop: 20,
632
     paddingTop: 20,
634
-    paddingBottom: PlatformIOS ? 0 : 20,
633
+    paddingBottom: 0,
635
     paddingLeft: 20,
634
     paddingLeft: 20,
636
     paddingRight: 20,
635
     paddingRight: 20,
637
     alignSelf: 'stretch',
636
     alignSelf: 'stretch',
638
     margin: 40,
637
     margin: 40,
639
-    borderRadius: PlatformIOS ? 8 : 2
638
+    borderRadius: 8
640
   },
639
   },
641
   button: {
640
   button: {
642
     fontSize: 16,
641
     fontSize: 16,
647
     marginTop: 5,
646
     marginTop: 5,
648
     marginBottom: 10,
647
     marginBottom: 10,
649
     borderBottomColor: '#4a4a4a',
648
     borderBottomColor: '#4a4a4a',
650
-    borderBottomWidth: PlatformIOS ? 1 / PixelRatio.get() : 0
649
+    borderBottomWidth: StyleSheet.hairlineWidth,
650
+    justifyContent :'flex-end',
651
+    height: 30,
652
+    paddingBottom: 1,
651
   },
653
   },
652
   inputTitle: {
654
   inputTitle: {
653
     color: '#4a4a4a'
655
     color: '#4a4a4a'
654
   },
656
   },
655
   input: {
657
   input: {
656
-    height: PlatformIOS ? 20 : 40,
657
-    paddingTop: 0
658
+    padding: 0,
659
+    margin: 0,
660
+    includeFontPadding:false,
658
   },
661
   },
659
   lineSeparator: {
662
   lineSeparator: {
660
     height: 1 / PixelRatio.get(),
663
     height: 1 / PixelRatio.get(),
661
     backgroundColor: '#d5d5d5',
664
     backgroundColor: '#d5d5d5',
662
     marginLeft: -20,
665
     marginLeft: -20,
663
     marginRight: -20,
666
     marginRight: -20,
664
-    marginTop: 20
667
+    marginTop: 15
665
   }
668
   }
666
 });
669
 });