rn-rich-text-editor 1.0.4 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rn-rich-text-editor",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "A rich text editor component for React Native",
5
5
  "keywords": [
6
6
  "react-native",
package/src/Editor.js CHANGED
@@ -335,15 +335,16 @@ export default class Editor extends Component {
335
335
  // useContainer is an optional prop with default value of true
336
336
  // If set to true, it will use a View wrapper with styles and height.
337
337
  // If set to false, it will not use a View wrapper
338
- const { useContainer, style, errorMessage } = this.props;
339
- const errorStyle = errorMessage ? { borderWidth: 1, borderColor: '#d92d20' } : {};
338
+ const { useContainer, style, errorMessage, readOnly, disabled } = this.props;
339
+ const errorStyle = !readOnly && errorMessage ? { borderWidth: 1, borderColor: '#d92d20' } : {};
340
+ const disabledStyle = disabled ? { backgroundColor: '#C9CED7' } : {};
340
341
 
341
342
  return useContainer ? (
342
- <View style={[editorBorderStyle, style, { height }, errorStyle]} onLayout={this.onViewLayout}>
343
+ <View style={[disabledStyle, style, { height }, errorStyle]} onLayout={this.onViewLayout}>
343
344
  {this.renderWebView()}
344
345
  </View>
345
346
  ) : (
346
- <View style={[editorBorderStyle, errorStyle]}>
347
+ <View style={[disabledStyle, style, errorStyle]}>
347
348
  {this.renderWebView()}
348
349
  </View>
349
350
  );
@@ -518,19 +519,6 @@ export default class Editor extends Component {
518
519
  }
519
520
  }
520
521
 
521
- const BORDER_COLOR = '#C9CED7';
522
- const BORDER_RADIUS = 6;
523
-
524
- const editorBorderStyle = {
525
- borderColor: BORDER_COLOR,
526
- borderTopWidth: 1,
527
- borderLeftWidth: 1,
528
- borderRightWidth: 1,
529
- borderBottomWidth: 1,
530
- borderTopLeftRadius: BORDER_RADIUS,
531
- borderTopRightRadius: BORDER_RADIUS,
532
- };
533
-
534
522
  const styles = StyleSheet.create({
535
523
  _input: {
536
524
  position: 'absolute',
package/src/Toolbar.js CHANGED
@@ -69,7 +69,7 @@ function getDefaultIcon() {
69
69
  texts[actions.insertImage] = require('./img/image.png');
70
70
  texts[actions.keyboard] = require('./img/keyboard.png');
71
71
  texts[actions.setBold] = require('./img/bold.png');
72
- texts[actions.setItalic] = require('./img/italic.svg');
72
+ texts[actions.setItalic] = require('./img/italic.png');
73
73
  texts[actions.setSubscript] = require('./img/subscript.png');
74
74
  texts[actions.setSuperscript] = require('./img/superscript.png');
75
75
  texts[actions.insertBulletsList] = require('./img/list.png');
@@ -97,7 +97,6 @@ function getDefaultIcon() {
97
97
  return texts;
98
98
  }
99
99
 
100
- // noinspection FallThroughInSwitchStatementJS
101
100
  export default class Toolbar extends Component {
102
101
  static defaultProps = {
103
102
  actions: defaultActions,
@@ -463,8 +462,9 @@ export default class Toolbar extends Component {
463
462
  if (readOnly) {
464
463
  return null;
465
464
  }
466
- const vStyle = [styles.barContainer, style, disabled && this._getButtonDisabledStyle()];
467
- const barBg = (style && style.backgroundColor) || TOOLBAR_BG;
465
+ const disabledStyle = disabled ? { backgroundColor: '#C9CED7' } : {};
466
+ const vStyle = [styles.barContainer, disabledStyle, style, disabled && this._getButtonDisabledStyle()];
467
+ const barBg = (style && style.backgroundColor) || (disabled && '#C9CED7') || TOOLBAR_BG;
468
468
  const showFades = horizontal;
469
469
  return (
470
470
  <View style={vStyle}>
@@ -503,21 +503,11 @@ export default class Toolbar extends Component {
503
503
  }
504
504
  }
505
505
 
506
- const BORDER_COLOR = '#C9CED7';
507
- const BORDER_RADIUS = 6;
508
-
509
506
  const styles = StyleSheet.create({
510
507
  barContainer: {
511
508
  height: 44,
512
509
  backgroundColor: '#efefef',
513
510
  alignItems: 'center',
514
- borderColor: BORDER_COLOR,
515
- borderTopWidth: 1,
516
- borderLeftWidth: 1,
517
- borderRightWidth: 1,
518
- borderBottomWidth: 1,
519
- borderBottomLeftRadius: BORDER_RADIUS,
520
- borderBottomRightRadius: BORDER_RADIUS,
521
511
  },
522
512
 
523
513
  item: {
@@ -799,7 +799,7 @@ function createReadOnlyHTML(options = {}) {
799
799
  height: 100%;
800
800
  overflow-y: auto;
801
801
  -webkit-overflow-scrolling: touch;
802
- padding: 10px;
802
+ padding: 0;
803
803
  ${contentCSSText}
804
804
  }
805
805
  </style>