rn-rich-text-editor 1.0.2 → 1.0.4

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.
Files changed (49) hide show
  1. package/README.md +2 -0
  2. package/package.json +8 -2
  3. package/src/Editor.js +15 -2
  4. package/src/Toolbar.js +26 -2
  5. package/src/img/italic.svg +3 -0
  6. package/src/img/blockquote@2x.png +0 -0
  7. package/src/img/blockquote@3x.png +0 -0
  8. package/src/img/bold@2x.png +0 -0
  9. package/src/img/bold@3x.png +0 -0
  10. package/src/img/checkbox@2x.png +0 -0
  11. package/src/img/checkbox@3x.png +0 -0
  12. package/src/img/code@2x.png +0 -0
  13. package/src/img/code@3x.png +0 -0
  14. package/src/img/fontSize@2x.png +0 -0
  15. package/src/img/fontSize@3x.png +0 -0
  16. package/src/img/image@2x.png +0 -0
  17. package/src/img/image@3x.png +0 -0
  18. package/src/img/italic@2x.png +0 -0
  19. package/src/img/italic@3x.png +0 -0
  20. package/src/img/justify_full@2x.png +0 -0
  21. package/src/img/justify_full@3x.png +0 -0
  22. package/src/img/justify_left@2x.png +0 -0
  23. package/src/img/justify_left@3x.png +0 -0
  24. package/src/img/keyboard@2x.png +0 -0
  25. package/src/img/keyboard@3x.png +0 -0
  26. package/src/img/line@2x.png +0 -0
  27. package/src/img/line@3x.png +0 -0
  28. package/src/img/link@2x.png +0 -0
  29. package/src/img/link@3x.png +0 -0
  30. package/src/img/outdent@2x.png +0 -0
  31. package/src/img/outdent@3x.png +0 -0
  32. package/src/img/redo@2x.png +0 -0
  33. package/src/img/redo@3x.png +0 -0
  34. package/src/img/remove_format@2x.png +0 -0
  35. package/src/img/remove_format@3x.png +0 -0
  36. package/src/img/strikethrough@2x.png +0 -0
  37. package/src/img/strikethrough@3x.png +0 -0
  38. package/src/img/subscript@2x.png +0 -0
  39. package/src/img/subscript@3x.png +0 -0
  40. package/src/img/superscript@2x.png +0 -0
  41. package/src/img/superscript@3x.png +0 -0
  42. package/src/img/table@2x.png +0 -0
  43. package/src/img/table@3x.png +0 -0
  44. package/src/img/underline@2x.png +0 -0
  45. package/src/img/underline@3x.png +0 -0
  46. package/src/img/undo@2x.png +0 -0
  47. package/src/img/undo@3x.png +0 -0
  48. package/src/img/video@2x.png +0 -0
  49. package/src/img/video@3x.png +0 -0
package/README.md CHANGED
@@ -31,6 +31,8 @@ Make sure you have these installed:
31
31
  npm install react react-native react-native-webview
32
32
  ```
33
33
 
34
+ If your app already has `react-native-svg-transformer` (e.g. in devDependencies), toolbar SVG icons (e.g. italic) work with no extra setup. Install `react-native-svg` for runtime.
35
+
34
36
  ## Quick Start
35
37
 
36
38
  ```tsx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rn-rich-text-editor",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "A rich text editor component for React Native",
5
5
  "keywords": [
6
6
  "react-native",
@@ -34,6 +34,12 @@
34
34
  "peerDependencies": {
35
35
  "react": "*",
36
36
  "react-native": "*",
37
- "react-native-webview": "*"
37
+ "react-native-webview": "*",
38
+ "react-native-svg": "*"
39
+ },
40
+ "peerDependenciesMeta": {
41
+ "react-native-svg": {
42
+ "optional": true
43
+ }
38
44
  }
39
45
  }
package/src/Editor.js CHANGED
@@ -339,11 +339,11 @@ export default class Editor extends Component {
339
339
  const errorStyle = errorMessage ? { borderWidth: 1, borderColor: '#d92d20' } : {};
340
340
 
341
341
  return useContainer ? (
342
- <View style={[style, { height }, errorStyle]} onLayout={this.onViewLayout}>
342
+ <View style={[editorBorderStyle, style, { height }, errorStyle]} onLayout={this.onViewLayout}>
343
343
  {this.renderWebView()}
344
344
  </View>
345
345
  ) : (
346
- <View style={errorStyle}>
346
+ <View style={[editorBorderStyle, errorStyle]}>
347
347
  {this.renderWebView()}
348
348
  </View>
349
349
  );
@@ -518,6 +518,19 @@ export default class Editor extends Component {
518
518
  }
519
519
  }
520
520
 
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
+
521
534
  const styles = StyleSheet.create({
522
535
  _input: {
523
536
  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.png');
72
+ texts[actions.setItalic] = require('./img/italic.svg');
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');
@@ -372,7 +372,17 @@ export default class Toolbar extends Component {
372
372
  onPress={() => that._onPress(action)}>
373
373
  {icon ? (
374
374
  typeof icon === 'function' ? (
375
- icon({ selected, disabled, tintColor, iconSize, iconGap })
375
+ icon({
376
+ selected,
377
+ disabled,
378
+ tintColor,
379
+ iconSize,
380
+ iconGap,
381
+ width: iconSize,
382
+ height: iconSize,
383
+ color: tintColor,
384
+ fill: tintColor,
385
+ })
376
386
  ) : (
377
387
  <Image
378
388
  source={icon}
@@ -419,6 +429,10 @@ export default class Toolbar extends Component {
419
429
  tintColor: tintColor,
420
430
  iconSize,
421
431
  iconGap,
432
+ width: iconSize,
433
+ height: iconSize,
434
+ color: tintColor,
435
+ fill: tintColor,
422
436
  })
423
437
  ) : (
424
438
  <Image
@@ -489,11 +503,21 @@ export default class Toolbar extends Component {
489
503
  }
490
504
  }
491
505
 
506
+ const BORDER_COLOR = '#C9CED7';
507
+ const BORDER_RADIUS = 6;
508
+
492
509
  const styles = StyleSheet.create({
493
510
  barContainer: {
494
511
  height: 44,
495
512
  backgroundColor: '#efefef',
496
513
  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,
497
521
  },
498
522
 
499
523
  item: {
@@ -0,0 +1,3 @@
1
+ <svg width="14" height="15" viewBox="0 0 14 15" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M12.5 0C12.9602 0 13.3333 0.373096 13.3333 0.833333C13.3333 1.29357 12.9602 1.66667 12.5 1.66667H9.74447L5.36947 13.3333H8.33333C8.79357 13.3333 9.16667 13.7064 9.16667 14.1667C9.16667 14.6269 8.79357 15 8.33333 15H0.833333C0.373096 15 0 14.6269 0 14.1667C0 13.7064 0.373096 13.3333 0.833333 13.3333H3.58887L7.96387 1.66667H5C4.53976 1.66667 4.16667 1.29357 4.16667 0.833333C4.16667 0.373096 4.53976 0 5 0H12.5Z" fill="currentColor"/>
3
+ </svg>
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file