This commit is contained in:
Firesieht 2021-04-24 14:52:07 +03:00
parent 854baf27a2
commit 0dd50d7299
3 changed files with 15 additions and 5 deletions

View File

@ -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 = () => {
<Document></Document>
</Route>
<Route path={url}>
<button onClick={}></button>
<div>
{data && data?.materialsByUser?.map( materials =>
<DocumentCard

View File

@ -28,6 +28,8 @@ export const Document:React.FC = () =>{
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))

View File

@ -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 (
<div onClick={this.stopPropagation}>
<div className="wrapper">
<DefaultButton handleClick={(e)=>this.test(e)} id={1} class="taskButton">Прочитать текст</DefaultButton>
<DefaultButton handleClick={(e)=>this.test(e)} id={2} class="taskButton">выбрать правильный вариант ответа</DefaultButton>
<DefaultButton handleClick={(e)=>this.test(e)} id={3} class="taskButton">правда/ложь</DefaultButton>
<DefaultButton handleClick={(e)=>this.test(e)} id={4} class="taskButton">расставить заголвки</DefaultButton>
<button onClick={(e)=>this.test(e)} id={1} class="taskButton">Прочитать текст</button>
<button handleClick={(e)=>this.test(e)} id={2} class="taskButton">выбрать правильный вариант ответа</button>
<button handleClick={(e)=>this.test(e)} id={3} class="taskButton">правда/ложь</button>
<button handleClick={(e)=>this.test(e)} id={4} class="taskButton">расставить заголвки</button>
</div>
</div>
);
@ -155,6 +156,8 @@ const Media = (props) => {
const type = entity.getType();
let media;
media = <div>audio</div>;
if (type === 'audio') {
media = <div>audio</div>;
} else if (type === "Прочитать текст") {