Correct session edition
authorymh <ymh.work@gmail.com>
Thu, 11 Oct 2018 11:05:04 +0200
changeset 169 f98efa1bddd1
parent 168 ea92f4fe783d
child 170 7da1d5137b0b
Correct session edition
client/src/components/SessionForm.js
client/src/components/SessionForm.scss
client/src/components/SlateEditor/index.js
--- a/client/src/components/SessionForm.js	Mon Oct 08 18:35:47 2018 +0200
+++ b/client/src/components/SessionForm.js	Thu Oct 11 11:05:04 2018 +0200
@@ -24,7 +24,7 @@
   }
 
   onChangeThrottle = _.debounce((changes) => {
-    this.props.sessionsActions.updateSession(this.props.currentSession, changes);
+    this.props.sessionsActions.updateSession(this.props.currentSession._id, changes);
   }, 750)
 
   onGroupChange = (e) => {
@@ -92,16 +92,19 @@
 
   saveEdit = (e) => {
 
+    // e.preventDefault();
 
-    if (e.key === 'Enter') {
-      this.setState({enterKeyValue: true})
-    }
+    // if (e.key === 'Enter') {
+    //   this.setState({enterKeyValue: true})
+    // }
 
-    if (e.key !== 'Enter') {
-      this.setState({enterKeyValue: false})
-    }
+    // if (e.key !== 'Enter') {
+    //   this.setState({enterKeyValue: false})
+    // }
 
     if (e.key === 'Enter' && this.state.enterKeyValue === true) {
+
+      e.preventDefault();
       this.setState({
         enterKeyValue: false,
         titleEditMode: false,
--- a/client/src/components/SessionForm.scss	Mon Oct 08 18:35:47 2018 +0200
+++ b/client/src/components/SessionForm.scss	Thu Oct 11 11:05:04 2018 +0200
@@ -9,10 +9,6 @@
         z-index: 5;
     }
 
-    &-page-card {
-        background: linear-gradient(white, transparent);
-    }
-
     &-page-title{
         font-size: 1.8rem;
         resize: auto;
--- a/client/src/components/SlateEditor/index.js	Mon Oct 08 18:35:47 2018 +0200
+++ b/client/src/components/SlateEditor/index.js	Thu Oct 11 11:05:04 2018 +0200
@@ -399,10 +399,6 @@
 
     const {value} = this.state;
 
-    // if (e.key === 'Enter' && value.document.text === '') {
-    //   change.removeChild()
-    // }
-
     if (e.key === 'Enter' && value.document.text !== '') {
       this.setState({enterKeyValue: 1})
     }
@@ -414,6 +410,7 @@
 
     }
 
+    //TODO review the double enter case.
     if (e.key === 'Enter' && !this.props.isChecked && this.state.enterKeyValue === 1 && typeof this.props.onEnterKeyDown === 'function') {
       e.preventDefault();
       this.props.onEnterKeyDown();