diff --git a/src/screens/BaseScreen/BaseScreen.tsx b/src/screens/BaseScreen/BaseScreen.tsx index 81449f5..c48a90f 100644 --- a/src/screens/BaseScreen/BaseScreen.tsx +++ b/src/screens/BaseScreen/BaseScreen.tsx @@ -6,6 +6,10 @@ import { Route, useRouteMatch, Switch } from "react-router"; import {useUpdateDocMutation} from "../../generated/graphql" import {Document} from "../../uiKit/Documents/Document/Document" +function createDoc(){ + +} + export const BaseScreen:react.FC = () => { let {url} = useRouteMatch(); const {loading, data} = useGetMaterialsQuery({variables:{token:localStorage.getItem("token")}}); @@ -35,6 +39,7 @@ export const BaseScreen:react.FC = () => { +
{data && data?.materialsByUser?.map( materials => { function onChange(state:any){ updateDoc({variables:{id:docID, content:JSON.stringify(convertToRaw(state))}}) } - + // let a = {"entityMap":{},"blocks":[{"key":"637gr","text":"Initialized from content state.","type":"unstyled","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}}]}; + // updateDoc({variables:{id:docID, content:JSON.stringify(a)}}) + let state = convertFromRaw(JSON.parse(data.material.content)) diff --git a/src/uiKit/Documents/TextEditor/TextEditor.jsx b/src/uiKit/Documents/TextEditor/TextEditor.jsx index 346de7a..23b9738 100644 --- a/src/uiKit/Documents/TextEditor/TextEditor.jsx +++ b/src/uiKit/Documents/TextEditor/TextEditor.jsx @@ -40,6 +40,7 @@ export class MyUserComponentEditor extends React.Component { test = (e) =>{ + console.log(e) this.Type_task = e.target.innerText this.confirmMedia() }; @@ -50,10 +51,10 @@ export class MyUserComponentEditor extends React.Component { return (
- this.test(e)} id={1} class="taskButton">Прочитать текст - this.test(e)} id={2} class="taskButton">выбрать правильный вариант ответа - this.test(e)} id={3} class="taskButton">правда/ложь - this.test(e)} id={4} class="taskButton">расставить заголвки + + + +
); @@ -155,6 +156,8 @@ const Media = (props) => { const type = entity.getType(); let media; + media =
audio
; + if (type === 'audio') { media =
audio
; } else if (type === "Прочитать текст") {