commit
856076a47e
@ -1,3 +1,5 @@
|
|||||||
|
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";
|
||||||
@ -27,12 +29,27 @@ 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 [summery, setSummery] = useState("");
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
apiRequest(
|
apiRequest(
|
||||||
`/profile/portfolio-projects?card_id=${localStorage.getItem("cardId")}`
|
`/profile/portfolio-projects?card_id=${localStorage.getItem("cardId")}`
|
||||||
).then((responseGit) => setGitInfo(responseGit));
|
).then((responseGit) => setGitInfo(responseGit));
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setSummery(profileInfo.vc_text);
|
||||||
|
}, [profileInfo]);
|
||||||
|
|
||||||
|
function editSummery() {
|
||||||
|
apiRequest("/resume/edit-text", {
|
||||||
|
method: "PUT",
|
||||||
|
data: {
|
||||||
|
resume: summery,
|
||||||
|
},
|
||||||
|
}).then(() => {});
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<div className="summary">
|
<div className="summary">
|
||||||
<ProfileHeader />
|
<ProfileHeader />
|
||||||
@ -101,12 +118,47 @@ 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>Редактировать раздел</button>
|
<button
|
||||||
|
className={editSummeryOpen ? "edit" : ""}
|
||||||
|
onClick={() => {
|
||||||
|
if (editSummeryOpen) {
|
||||||
|
editSummery();
|
||||||
|
}
|
||||||
|
setEditSummeryOpen(!editSummeryOpen);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{editSummeryOpen ? "Сохранить" : "Редактировать раздел"}
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div
|
{editSummeryOpen ? (
|
||||||
className="experience__content"
|
<CKEditor
|
||||||
dangerouslySetInnerHTML={{ __html: profileInfo.vc_text }}
|
editor={ClassicEditor}
|
||||||
></div>
|
data={summery}
|
||||||
|
config={{
|
||||||
|
removePlugins: [
|
||||||
|
"CKFinderUploadAdapter",
|
||||||
|
"CKFinder",
|
||||||
|
"EasyImage",
|
||||||
|
"Image",
|
||||||
|
"ImageCaption",
|
||||||
|
"ImageStyle",
|
||||||
|
"ImageToolbar",
|
||||||
|
"ImageUpload",
|
||||||
|
"MediaEmbed",
|
||||||
|
"BlockQuote",
|
||||||
|
],
|
||||||
|
}}
|
||||||
|
onChange={(event, editor) => {
|
||||||
|
const data = editor.getData();
|
||||||
|
setSummery(data);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<div
|
||||||
|
className="experience__content"
|
||||||
|
dangerouslySetInnerHTML={{ __html: summery }}
|
||||||
|
></div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
@ -220,6 +220,11 @@
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.edit {
|
||||||
|
background-color: green;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.skills__section {
|
.skills__section {
|
||||||
@ -287,6 +292,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ck-toolbar {
|
||||||
|
border: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ck-content {
|
||||||
|
border: none !important;
|
||||||
|
padding: 15px 35px 15px 50px !important;
|
||||||
|
}
|
||||||
|
|
||||||
&__sectionGit {
|
&__sectionGit {
|
||||||
margin-top: 25px;
|
margin-top: 25px;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user