Bläddra i källkod

Pass footerHeight as prop

ihork 7 år sedan
förälder
incheckning
5d75ad3b77
4 ändrade filer med 13 tillägg och 5 borttagningar
  1. 9
    1
      src/RichTextEditor.js
  2. 3
    0
      src/WebviewMessageHandler.js
  3. 1
    0
      src/const.js
  4. 0
    4
      src/editor.html

+ 9
- 1
src/RichTextEditor.js Visa fil

@@ -21,7 +21,8 @@ export default class RichTextEditor extends Component {
21 21
     editorInitializedCallback: PropTypes.func,
22 22
     customCSS: PropTypes.string,
23 23
     hiddenTitle: PropTypes.bool,
24
-    enableOnChange: PropTypes.bool
24
+    enableOnChange: PropTypes.bool,
25
+    footerHeight: PropTypes.number
25 26
   };
26 27
 
27 28
   constructor(props) {
@@ -504,12 +505,19 @@ export default class RichTextEditor extends Component {
504 505
   init() {
505 506
     this._sendAction(actions.init);
506 507
     this.setPlatform();
508
+    if (this.props.footerHeight) {
509
+      this.setFooterHeight();
510
+    }
507 511
   }
508 512
 
509 513
   setEditorHeight(height) {
510 514
     this._sendAction(actions.setEditorHeight, height);
511 515
   }
512 516
 
517
+  setFooterHeight() {
518
+    this._sendAction(actions.setFooterHeight, this.props.footerHeight);
519
+  }
520
+
513 521
   setPlatform() {
514 522
     this._sendAction(actions.setPlatform, Platform.OS);
515 523
   }

+ 3
- 0
src/WebviewMessageHandler.js Visa fil

@@ -164,6 +164,9 @@ export const InjectedMessageHandler = `
164 164
         case '${actions.setEditorHeight}':
165 165
           zss_editor.setEditorHeight(action.data);
166 166
           break;
167
+        case '${actions.setFooterHeight}':
168
+          zss_editor.setFooterHeight(action.data);
169
+          break;
167 170
         case '${actions.setPlatform}':
168 171
           zss_editor.setPlatform(action.data);
169 172
           break;

+ 1
- 0
src/const.js Visa fil

@@ -51,6 +51,7 @@ export const actions = {
51 51
   setBackgroundColor: 'SET_BACKGROUND_COLOR',
52 52
   init: 'ZSSS_INIT',
53 53
   setEditorHeight: 'SET_EDITOR_HEIGHT',
54
+  setFooterHeight: 'SET_FOOTER_HEIGHT',
54 55
   setPlatform: 'SET_PLATFORM'
55 56
 };
56 57
 

+ 0
- 4
src/editor.html Visa fil

@@ -1710,10 +1710,6 @@
1710 1710
 				padding-left: 10px;
1711 1711
 				padding-right: 10px;
1712 1712
 			}
1713
-
1714
-			#zss_editor_footer {
1715
-				height: 10px;
1716
-			}
1717 1713
 		</style>
1718 1714
 
1719 1715
 		<style type="text/css">