client/src/components/SlateEditor.js
changeset 138 a1fb2ced3049
parent 103 dc906a578616
child 143 cfcbf4bc66f1
equal deleted inserted replaced
137:279e1dffa213 138:a1fb2ced3049
     5 import Immutable from 'immutable'
     5 import Immutable from 'immutable'
     6 import HtmlSerializer from '../HtmlSerializer'
     6 import HtmlSerializer from '../HtmlSerializer'
     7 import AnnotationPlugin from '../AnnotationPlugin'
     7 import AnnotationPlugin from '../AnnotationPlugin'
     8 import CategoriesTooltip from './CategoriesTooltip'
     8 import CategoriesTooltip from './CategoriesTooltip'
     9 import { now } from '../utils';
     9 import { now } from '../utils';
       
    10 import { defaultAnnotationsCategories } from '../constants';
    10 
    11 
    11 const plugins = [];
    12 const plugins = [];
    12 
    13 
    13 /**
    14 /**
    14  * Define the default node type.
    15  * Define the default node type.
    44       textDecoration: 'underline'
    45       textDecoration: 'underline'
    45     }
    46     }
    46   }
    47   }
    47 }
    48 }
    48 
    49 
    49 const annotationCategories = [
       
    50   { key: 'important', name: 'Important',    color: '#F1C40F' },
       
    51   { key: 'keyword',   name: 'Mot-clé',      color: '#2ECC71' },
       
    52   { key: 'comment',   name: 'Commentaire',  color: '#3498DB', hasComment: true }
       
    53 ];
       
    54 
       
    55 /**
    50 /**
    56  * The rich text example.
    51  * The rich text example.
    57  *
    52  *
    58  * @type {Component}
    53  * @type {Component}
    59  */
    54  */
   529         isOpened={this.state.isPortalOpen} isOpen={this.state.isPortalOpen}
   524         isOpened={this.state.isPortalOpen} isOpen={this.state.isPortalOpen}
   530         onOpen={this.onPortalOpen}
   525         onOpen={this.onPortalOpen}
   531         onClose={this.onPortalClose}
   526         onClose={this.onPortalClose}
   532         closeOnOutsideClick={false} closeOnEsc={true}>
   527         closeOnOutsideClick={false} closeOnEsc={true}>
   533         <div className="hovering-menu">
   528         <div className="hovering-menu">
   534           <CategoriesTooltip categories={annotationCategories} onCategoryClick={this.onCategoryClick} />
   529           <CategoriesTooltip categories={this.props.annotationCategories || defaultAnnotationsCategories} onCategoryClick={this.onCategoryClick} />
   535         </div>
   530         </div>
   536       </Portal>
   531       </Portal>
   537     )
   532     )
   538   }
   533   }
   539 
   534