|
| 1 | +// import R from 'ramda' |
| 2 | +import{useEffect}from'react' |
| 3 | + |
| 4 | +// import { TYPE, EVENT, ERR } from '@constant' |
| 5 | +import{buildLog}from'@utils' |
| 6 | + |
| 7 | +letstore=null |
| 8 | +/* eslint-disable-next-line */ |
| 9 | +constlog=buildLog('L:RichEditor') |
| 10 | + |
| 11 | +exportconstsomeMethod=()=>{} |
| 12 | + |
| 13 | +// const const cancleLoading = () => {} |
| 14 | + |
| 15 | +// ############################### |
| 16 | +// Data & Error handlers |
| 17 | +// ############################### |
| 18 | + |
| 19 | +// ############################### |
| 20 | +// init & uninit |
| 21 | +// ############################### |
| 22 | + |
| 23 | +exportconstuseInit=(_store,loaded)=>{ |
| 24 | +useEffect(()=>{ |
| 25 | +store=_store |
| 26 | +log('effect init: ',store) |
| 27 | + |
| 28 | +if(loaded){ |
| 29 | +// eslint-disable-next-line |
| 30 | +newEditorJS({ |
| 31 | +/** |
| 32 | + * Id of Element that should contain Editor instance |
| 33 | + */ |
| 34 | +holderId:'codex-editor', |
| 35 | +data:{ |
| 36 | +time:1552744582955, |
| 37 | +blocks:[ |
| 38 | +{ |
| 39 | +type:'paragraph', |
| 40 | +data:{ |
| 41 | +text:'this is @', |
| 42 | +}, |
| 43 | +}, |
| 44 | +], |
| 45 | +version:'2.11.10', |
| 46 | +}, |
| 47 | +}) |
| 48 | +} |
| 49 | + |
| 50 | +return()=>{ |
| 51 | +// log('effect uninit') |
| 52 | +} |
| 53 | +},[_store,loaded]) |
| 54 | +} |