HtmlDocument.jsx 2.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. import React from 'react'
  2. import { TextAreaApp } from 'tracim_frontend_lib'
  3. import { MODE } from '../helper.js'
  4. const HtmlDocument = props => {
  5. return (
  6. <div className='wsContentHtmlDocument__contentpage__textnote html-document__contentpage__textnote'>
  7. {props.isArchived &&
  8. <div className='html-document__contentpage__textnote__state'>
  9. <div className='html-document__contentpage__textnote__state__msg'>
  10. <i className='fa fa-fw fa-archive' />
  11. This content is archived.
  12. </div>
  13. <button className='html-document__contentpage__textnote__state__btnrestore btn' onClick={props.onClickRestoreArchived}>
  14. <i className='fa fa-fw fa-archive' />
  15. Restore
  16. </button>
  17. </div>
  18. }
  19. {props.isDeleted &&
  20. <div className='html-document__contentpage__textnote__state'>
  21. <div className='html-document__contentpage__textnote__state__msg'>
  22. <i className='fa fa-fw fa-trash' />
  23. Ce contenu est supprimé.
  24. </div>
  25. <button className='html-document__contentpage__textnote__state__btnrestore btn' onClick={props.onClickRestoreDeleted}>
  26. <i className='fa fa-fw fa-trash' />
  27. Restore
  28. </button>
  29. </div>
  30. }
  31. {(props.mode === MODE.VIEW || props.mode === MODE.REVISION) &&
  32. <div>
  33. <div className='html-document__contentpage__textnote__version'>
  34. version n°
  35. <div dangerouslySetInnerHTML={{__html: props.mode === MODE.VIEW ? props.lastVersion : props.version}} />
  36. {props.mode === MODE.REVISION &&
  37. <div className='html-document__contentpage__textnote__lastversion'>
  38. (dernière version : {props.lastVersion})
  39. </div>
  40. }
  41. </div>
  42. {/* need try to inject html in stateless component () => <span>{props.text}</span> */}
  43. <div className='html-document__contentpage__textnote__text' dangerouslySetInnerHTML={{__html: props.text}} />
  44. </div>
  45. }
  46. {props.mode === MODE.EDIT &&
  47. <TextAreaApp
  48. id={props.wysiwygNewVersion}
  49. customClass={'html-document__editionmode'}
  50. customColor={props.customColor}
  51. onClickCancelBtn={props.onClickCloseEditMode}
  52. onClickValidateBtn={props.onClickValidateBtn}
  53. text={props.text}
  54. onChangeText={props.onChangeText}
  55. />
  56. }
  57. </div>
  58. )
  59. }
  60. export default HtmlDocument