editSummary
This commit is contained in:
parent
c514062efe
commit
ca2e917fc4
@ -1,8 +1,8 @@
|
|||||||
|
import ClassicEditor from "@ckeditor/ckeditor5-build-classic";
|
||||||
|
import { CKEditor } from "@ckeditor/ckeditor5-react";
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
import { Navigate } from "react-router-dom";
|
import { Navigate } from "react-router-dom";
|
||||||
import ClassicEditor from "@ckeditor/ckeditor5-build-classic";
|
|
||||||
import { CKEditor } from "@ckeditor/ckeditor5-react";
|
|
||||||
|
|
||||||
import { getProfileInfo } from "@redux/outstaffingSlice";
|
import { getProfileInfo } from "@redux/outstaffingSlice";
|
||||||
|
|
||||||
@ -29,8 +29,8 @@ export const Summary = () => {
|
|||||||
const profileInfo = useSelector(getProfileInfo);
|
const profileInfo = useSelector(getProfileInfo);
|
||||||
const [openGit, setOpenGit] = useState(false);
|
const [openGit, setOpenGit] = useState(false);
|
||||||
const [gitInfo, setGitInfo] = useState([]);
|
const [gitInfo, setGitInfo] = useState([]);
|
||||||
const [editSummeryOpen, setEditSummeryOpen] = useState(false)
|
const [editSummeryOpen, setEditSummeryOpen] = useState(false);
|
||||||
const [summery, setSummery] = useState('')
|
const [summery, setSummery] = useState("");
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
apiRequest(
|
apiRequest(
|
||||||
@ -39,18 +39,16 @@ export const Summary = () => {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setSummery(profileInfo.vc_text)
|
setSummery(profileInfo.vc_text);
|
||||||
}, [profileInfo])
|
}, [profileInfo]);
|
||||||
|
|
||||||
function editSummery() {
|
function editSummery() {
|
||||||
apiRequest("/resume/edit-text", {
|
apiRequest("/resume/edit-text", {
|
||||||
method: "PUT",
|
method: "PUT",
|
||||||
data: {
|
data: {
|
||||||
resume: summery
|
resume: summery,
|
||||||
},
|
},
|
||||||
}).then(() => {
|
}).then(() => {});
|
||||||
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<div className="summary">
|
<div className="summary">
|
||||||
@ -120,16 +118,19 @@ export const Summary = () => {
|
|||||||
<div className="experience__block">
|
<div className="experience__block">
|
||||||
<div className="summary__sections__head">
|
<div className="summary__sections__head">
|
||||||
<h3>Описание опыта работы</h3>
|
<h3>Описание опыта работы</h3>
|
||||||
<button className={editSummeryOpen ? 'edit' : ''} onClick={() => {
|
<button
|
||||||
|
className={editSummeryOpen ? "edit" : ""}
|
||||||
|
onClick={() => {
|
||||||
if (editSummeryOpen) {
|
if (editSummeryOpen) {
|
||||||
editSummery()
|
editSummery();
|
||||||
}
|
}
|
||||||
setEditSummeryOpen(!editSummeryOpen)
|
setEditSummeryOpen(!editSummeryOpen);
|
||||||
}}>{
|
}}
|
||||||
editSummeryOpen ? 'Сохранить' : 'Редактировать раздел'
|
>
|
||||||
}</button>
|
{editSummeryOpen ? "Сохранить" : "Редактировать раздел"}
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
{editSummeryOpen ?
|
{editSummeryOpen ? (
|
||||||
<CKEditor
|
<CKEditor
|
||||||
editor={ClassicEditor}
|
editor={ClassicEditor}
|
||||||
data={summery}
|
data={summery}
|
||||||
@ -152,13 +153,12 @@ export const Summary = () => {
|
|||||||
setSummery(data);
|
setSummery(data);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
:
|
) : (
|
||||||
<div
|
<div
|
||||||
className="experience__content"
|
className="experience__content"
|
||||||
dangerouslySetInnerHTML={{ __html: summery }}
|
dangerouslySetInnerHTML={{ __html: summery }}
|
||||||
>
|
></div>
|
||||||
</div>
|
)}
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
Loading…
Reference in New Issue
Block a user