client/src/components/SlateEditor.js
changeset 17 877d8796b86d
parent 16 e67cd18cc594
child 19 f1b125b95fe9
equal deleted inserted replaced
16:e67cd18cc594 17:877d8796b86d
     1 import { Editor, Plain, Raw } from 'slate'
     1 import { Editor, Plain, Raw } from 'slate'
     2 import React from 'react'
     2 import React from 'react'
     3 import moment from 'moment';
     3 import moment from 'moment';
       
     4 import HtmlSerializer from '../HtmlSerializer'
     4 
     5 
     5 /**
     6 /**
     6  * Define the default node type.
     7  * Define the default node type.
     7  */
     8  */
     8 
     9 
   135 
   136 
   136   asRaw = () => {
   137   asRaw = () => {
   137     return Raw.serialize(this.state.state);
   138     return Raw.serialize(this.state.state);
   138   }
   139   }
   139 
   140 
       
   141   asHtml = () => {
       
   142     return HtmlSerializer.serialize(this.state.state);
       
   143   }
       
   144 
   140   clear = () => {
   145   clear = () => {
   141     const state = Plain.deserialize('');
   146     const state = Plain.deserialize('');
   142     this.onChange(state);
   147     this.onChange(state);
   143   }
   148   }
   144 
   149