diff --git a/src/components/MarkDown.jsx b/src/components/MarkDown.jsx
index e9027e8..b01cc71 100644
--- a/src/components/MarkDown.jsx
+++ b/src/components/MarkDown.jsx
@@ -9,6 +9,7 @@ const MarkDown = ({mkValue, setMkValue}) => {
value={mkValue}
onChange={(value, viewUpdate) => setMkValue(value)}
enablePreview={false}
+ visibleDragbar={false}
/>
diff --git a/src/hooks/sundry/parseLinkVideo.js b/src/hooks/sundry/parseLinkVideo.js
new file mode 100644
index 0000000..6240421
--- /dev/null
+++ b/src/hooks/sundry/parseLinkVideo.js
@@ -0,0 +1,75 @@
+const serviceVideo = {
+ "www.youtube.com": parseYTlinkVideo,
+ "youtu.be": parseMobileYTlinkVideo,
+ "vk.com": parseVKlinkVideo,
+ "rutube.ru": parseRTlinkVideo
+}
+
+function parseYTlinkVideo(link) {
+ const startIndexIdVideo = link.indexOf("watch?v=") + 8;
+ const endIndexIdVideo = link.indexOf("&");
+ const idVideo = endIndexIdVideo === -1 ?
+ link.slice(startIndexIdVideo) :
+ link.slice(startIndexIdVideo, endIndexIdVideo);
+
+ return `https://www.youtube.com/embed/${idVideo}`
+};
+
+function parseMobileYTlinkVideo(link) {
+ const startIndexIdVideo = 17;
+ const endIndexIdVideo = link.indexOf("?");
+ const idVideo = endIndexIdVideo === -1 ?
+ link.slice(startIndexIdVideo) :
+ link.slice(startIndexIdVideo, endIndexIdVideo);
+
+ return `https://www.youtube.com/embed/${idVideo}`
+};
+
+function parseVKlinkVideo(link) {
+ let idVideo = "";
+
+ if (link.indexOf("video?z=video") !== -1) {
+ const startIndexIdVideo = link.indexOf("video?z=video") + 13;
+ const endIndexIdVideo = link.lastIndexOf("%");
+ idVideo = link.slice(startIndexIdVideo, endIndexIdVideo);
+ }
+ else if (link.indexOf("video") !== -1) {
+ const startIndexIdVideo = link.indexOf("video") + 5;
+ idVideo = link.slice(startIndexIdVideo)
+ }
+
+ const oid = idVideo.slice(0, idVideo.indexOf("_"));
+ const id = idVideo.slice(idVideo.indexOf("_") + 1);
+
+ return `https://vk.com/video_ext.php?oid=${oid}&id=${id}&hd=2`
+};
+
+function parseRTlinkVideo(link) {
+ const startIndexIdVideo = link.indexOf("video/") + 6;
+ const endIndexIdVideo = link.lastIndexOf("?r=a");
+ const idVideo = endIndexIdVideo === -1 ?
+ link.slice(startIndexIdVideo) :
+ link.slice(startIndexIdVideo, endIndexIdVideo);
+
+ return `https://rutube.ru/play/embed/${idVideo}`
+};
+
+function parseTotalLinkVideo(link) {
+ const serviceLink = {
+ check: false,
+ parseLink: ""
+ };
+
+ if (link) {
+ for (let key of Object.keys(serviceVideo)) {
+ if (link.indexOf(key) !== -1) {
+ serviceLink.parseLink = serviceVideo[key](link);
+ serviceLink.check = true;
+ }
+ }
+ }
+
+ return serviceLink
+};
+
+export { parseYTlinkVideo, parseVKlinkVideo, parseTotalLinkVideo }
\ No newline at end of file
diff --git a/src/pages/NewForm.jsx b/src/pages/NewForm.jsx
index 0eb4116..46cc9f4 100644
--- a/src/pages/NewForm.jsx
+++ b/src/pages/NewForm.jsx
@@ -9,7 +9,7 @@ import { FormsData, TypeAnswerData } from "../context";
import { listFormsApi, updateTitleFormApi } from "../hooks/api/listFormsApi.js";
import { saveFormApi, addFormBlockApi, listFormBlockApi, updateBlockApi, updateOrderBlockApi } from "../hooks/api/formApi.js";
import { responseDataToListBlock } from "../hooks/sundry/parseListBlock.js";
-import MarkDown from "../components/MarkDown.jsx";
+import { parseVKlinkVideo } from "../hooks/sundry/parseLinkVideo.js";
const NewForm = () => {
const navigate = useNavigate();
@@ -136,6 +136,8 @@ const NewForm = () => {
video: video
}
+ console.log(parseVKlinkVideo(video))
+
const response = await addFormBlockApi(cookies.token, formId, newBlock)
if (response.status === 200) {