ecomlab-components-next 0.1.31 → 0.1.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/fetchUrls.js +7 -2
- package/dist/common/headers.js +2 -1
- package/dist/common/hooks/useDebounce.js +37 -0
- package/dist/common/hooks/useTextSelectionInModal.js +41 -0
- package/dist/components/Article/ArcticleWiki/ArcticleWiki.stories.js +152 -0
- package/dist/components/Article/ArcticleWiki/ArticleWiki.js +775 -0
- package/dist/components/Article/ArcticleWiki/ArticleWiki.scss +278 -0
- package/dist/components/Article/ArticleViewV2/ArticleViewV2.js +791 -0
- package/dist/components/Article/ArticleViewV2/ArticleViewV2.scss +245 -0
- package/dist/components/Article/ArticleViewV2/ArticleViewV2.stories.js +166 -0
- package/dist/components/Article/ArticleViewV2/img/bell.svg +9 -0
- package/dist/components/Article/ArticleViewV2/img/btn-add-round.svg +4 -0
- package/dist/components/Article/ArticleViewV2/img/calendar_icon.svg +6 -0
- package/dist/components/Article/ArticleViewV2/img/close-round.svg +3 -0
- package/dist/components/Article/ArticleViewV2/img/close.svg +9 -0
- package/dist/components/Article/ArticleViewV2/img/copy_icon.svg +5 -0
- package/dist/components/Article/ArticleViewV2/img/dndMenu.svg +1 -0
- package/dist/components/Article/ArticleViewV2/img/info.svg +9 -0
- package/dist/components/Article/ArticleViewV2/img/ok_icon.svg +5 -0
- package/dist/components/Article/ArticleViewV2/img/plus_circle.svg +6 -0
- package/dist/components/Article/ArticleViewV2/img/share_icon.svg +5 -0
- package/dist/components/Article/ArticleViewV2/img/tg.svg +3 -0
- package/dist/components/Article/ArticleViewV2/img/tg_icon.svg +5 -0
- package/dist/components/Article/ArticleViewV2/img/time_icon.svg +6 -0
- package/dist/components/Article/ArticleViewV2/img/view_icon.svg +6 -0
- package/dist/components/Article/ArticleViewV2/img/vk_icon.svg +5 -0
- package/dist/components/Article/ArticleViewV2/img/whatsapp_icon.svg +5 -0
- package/dist/components/Article/Breadcrumb/Breadcrumb.js +69 -0
- package/dist/components/Article/Breadcrumb/Breadcrumb.scss +96 -0
- package/dist/components/Article/Breadcrumb/img/drop-right.svg +3 -0
- package/dist/components/Article/Breadcrumb/img/home_icon.svg +5 -0
- package/dist/components/Article/EditWrapper/EditWrapper.js +108 -0
- package/dist/components/Article/EditWrapper/EditWrapper.scss +93 -0
- package/dist/components/Article/EditWrapper/img/bx-grid-vertical.svg +5 -0
- package/dist/components/Article/Editor/Editor.js +92 -0
- package/dist/components/Article/Editor/Editor.scss +35 -0
- package/dist/components/Article/Editor/img/copy.svg +6 -0
- package/dist/components/Article/FormBtn/FormBtn.js +229 -0
- package/dist/components/Article/FormBtn/FormBtn.scss +458 -0
- package/dist/components/Article/FormBtn/ModalBitrixForm/ModalBitrixForm.js +282 -0
- package/dist/components/Article/FormBtn/ModalBitrixForm/ModalBitrixForm.scss +140 -0
- package/dist/components/Article/FormBtn/ModalBitrixForm/img/close_icon.svg +3 -0
- package/dist/components/Article/FormBtn/ModalBitrixForm/img/done_icon.svg +3 -0
- package/dist/components/Article/FormBtn/ModalBitrixForm/img/ozon.svg +9 -0
- package/dist/components/Article/FormBtn/ModalBitrixForm/img/ozon_bkg.svg +9 -0
- package/dist/components/Article/FormBtn/ModalBitrixForm/validationFunc.js +14 -0
- package/dist/components/Article/FormBtn/img/clos_icon.svg +6 -0
- package/dist/components/Article/FormBtn/img/close-icon.svg +3 -0
- package/dist/components/Article/ImgArticle/ImgArticle.js +297 -0
- package/dist/components/Article/ImgArticle/ImgArticle.scss +169 -0
- package/dist/components/Article/ImgArticle/img/noPhoto.png +0 -0
- package/dist/components/Article/InformationBlock/InformationBlock.js +200 -0
- package/dist/components/Article/InformationBlock/InformationBlock.scss +89 -0
- package/dist/components/Article/InformationBlock/img/bell.svg +9 -0
- package/dist/components/Article/ListOfContent/ListOfContent.js +110 -0
- package/dist/components/Article/ListOfContent/ListOfContent.scss +115 -0
- package/dist/components/Article/ListOfContent/img/time_icon.svg +3 -0
- package/dist/components/Article/ListOfContent/img/view_icon.svg +3 -0
- package/dist/components/Article/ModalMiltilevelSidebarSettings/ModalMiltilevelSidebarSettings.js +973 -0
- package/dist/components/Article/ModalMiltilevelSidebarSettings/ModalMiltilevelSidebarSettings.scss +254 -0
- package/dist/components/Article/ModalMiltilevelSidebarSettings/ModalMiltilevelSidebarSettings.stories.js +76 -0
- package/dist/components/Article/ModalMiltilevelSidebarSettings/img/bx-cog.png +0 -0
- package/dist/components/Article/ModalMiltilevelSidebarSettings/img/bx-cog.svg +4 -0
- package/dist/components/Article/ModalMiltilevelSidebarSettings/img/bx-trash.png +0 -0
- package/dist/components/Article/ModalMiltilevelSidebarSettings/img/bx-trash.svg +4 -0
- package/dist/components/Article/ModalMiltilevelSidebarSettings/img/drop_icon.svg +5 -0
- package/dist/components/Article/ModalMiltilevelSidebarSettings/img/edit_icon.svg +6 -0
- package/dist/components/Article/ModalMiltilevelSidebarSettings/img/trash_icon.svg +8 -0
- package/dist/components/Article/ModalReplaceBlock/ModalReplaceBlock.js +85 -0
- package/dist/components/Article/ModalReplaceBlock/ModalReplaceBlock.scss +72 -0
- package/dist/components/Article/SelectedBlocks/SelectedBlocks.js +281 -0
- package/dist/components/Article/SelectedBlocks/SelectedBlocks.scss +0 -0
- package/dist/components/Article/SocialMedia/ModalSelectionSocialMedia/ModalSelectionSocialMedia.js +130 -0
- package/dist/components/Article/SocialMedia/ModalSelectionSocialMedia/ModalSelectionSocialMedia.scss +65 -0
- package/dist/components/Article/SocialMedia/ModalSelectionSocialMedia/img/Facebook.svg +4 -0
- package/dist/components/Article/SocialMedia/ModalSelectionSocialMedia/img/OK.svg +4 -0
- package/dist/components/Article/SocialMedia/ModalSelectionSocialMedia/img/Xcom.svg +9 -0
- package/dist/components/Article/SocialMedia/ModalSelectionSocialMedia/img/linkedin.svg +5 -0
- package/dist/components/Article/SocialMedia/ModalSelectionSocialMedia/img/tg.svg +4 -0
- package/dist/components/Article/SocialMedia/ModalSelectionSocialMedia/img/vk.svg +4 -0
- package/dist/components/Article/SocialMedia/ModalSelectionSocialMedia/img/wtsp.svg +4 -0
- package/dist/components/Article/SocialMedia/SocialMedia.js +242 -0
- package/dist/components/Article/SocialMedia/SocialMedia.scss +57 -0
- package/dist/components/Article/SocialMedia/img/dzen.svg +4 -0
- package/dist/components/Article/SocialMedia/img/facebook.svg +4 -0
- package/dist/components/Article/SocialMedia/img/insta.svg +9 -0
- package/dist/components/Article/SocialMedia/img/linkendIn.svg +5 -0
- package/dist/components/Article/SocialMedia/img/ok.svg +4 -0
- package/dist/components/Article/SocialMedia/img/pikabu.svg +9 -0
- package/dist/components/Article/SocialMedia/img/telegram.svg +4 -0
- package/dist/components/Article/SocialMedia/img/vcru.svg +0 -0
- package/dist/components/Article/SocialMedia/img/vk.svg +4 -0
- package/dist/components/Article/SocialMedia/img/wp.svg +4 -0
- package/dist/components/Article/SocialMedia/img/x.svg +9 -0
- package/dist/components/Article/TextArticle/TextArticle.js +257 -0
- package/dist/components/Article/TextArticle/TextArticle.scss +156 -0
- package/dist/components/Article/TextArticle/img/dndMenu.svg +1 -0
- package/dist/components/Article/TitleText/TitleText.js +157 -0
- package/dist/components/Article/TitleText/TitleText.scss +74 -0
- package/dist/components/Article/VideoArticle/VideoArticle.js +248 -0
- package/dist/components/Article/VideoArticle/VideoArticle.scss +147 -0
- package/dist/components/Buttons/ButtonActionDrop/ButtonActionDrop.js +109 -0
- package/dist/components/Buttons/ButtonActionDrop/ButtonActionDrop.scss +97 -0
- package/dist/components/Buttons/ButtonActionDrop/img/bx-dots-horizontal-rounded.svg +3 -0
- package/dist/components/ConstructorComponents/MainContainer/MainContainer.js +2 -73
- package/dist/components/ConstructorComponents/MainContainer/MainContainer.stories.js +73 -3
- package/package.json +3 -2
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.VideoArticle = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _universalCookie = _interopRequireDefault(require("universal-cookie"));
|
|
11
|
+
var _EditWrapper = require("../EditWrapper/EditWrapper");
|
|
12
|
+
var _useDebounce = require("../../../common/hooks/useDebounce");
|
|
13
|
+
require("./VideoArticle.scss");
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
15
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
16
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
17
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
18
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
19
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
20
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
21
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
22
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
23
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
24
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
25
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
26
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
27
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
28
|
+
var VideoArticle = exports.VideoArticle = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
29
|
+
var _data$;
|
|
30
|
+
var data = _ref.data,
|
|
31
|
+
editMode = _ref.editMode,
|
|
32
|
+
onChange = _ref.onChange,
|
|
33
|
+
changeContent = _ref.changeContent,
|
|
34
|
+
position = _ref.position,
|
|
35
|
+
setContentArr = _ref.setContentArr,
|
|
36
|
+
id = _ref.id,
|
|
37
|
+
setCurrentIndex = _ref.setCurrentIndex,
|
|
38
|
+
ind = _ref.ind,
|
|
39
|
+
setIsModal = _ref.setIsModal,
|
|
40
|
+
before = _ref.before,
|
|
41
|
+
setBeforeBlock = _ref.setBeforeBlock,
|
|
42
|
+
deleteBlock = _ref.deleteBlock,
|
|
43
|
+
_ref$readonly = _ref.readonly,
|
|
44
|
+
readonly = _ref$readonly === void 0 ? false : _ref$readonly,
|
|
45
|
+
draggableElement = _ref.draggableElement,
|
|
46
|
+
setDraggableElement = _ref.setDraggableElement,
|
|
47
|
+
articleId = _ref.articleId,
|
|
48
|
+
fetchDataById = _ref.fetchDataById,
|
|
49
|
+
changeBlock = _ref.changeBlock;
|
|
50
|
+
var _useState = (0, _react.useState)(""),
|
|
51
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
52
|
+
extension = _useState2[0],
|
|
53
|
+
setExtension = _useState2[1];
|
|
54
|
+
var _useState3 = (0, _react.useState)(false),
|
|
55
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
56
|
+
error = _useState4[0],
|
|
57
|
+
setError = _useState4[1];
|
|
58
|
+
var _useState5 = (0, _react.useState)(false),
|
|
59
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
60
|
+
isOpen = _useState6[0],
|
|
61
|
+
setOpen = _useState6[1];
|
|
62
|
+
var fileInputRef = (0, _react.useRef)();
|
|
63
|
+
var cookies = new _universalCookie["default"]();
|
|
64
|
+
var activeLang = localStorage.getItem('lang');
|
|
65
|
+
var _useState7 = (0, _react.useState)(null),
|
|
66
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
67
|
+
objImg = _useState8[0],
|
|
68
|
+
setObjImg = _useState8[1];
|
|
69
|
+
var _useState9 = (0, _react.useState)(((_data$ = data[0]) === null || _data$ === void 0 || (_data$ = _data$.properties) === null || _data$ === void 0 ? void 0 : _data$.alt) || ''),
|
|
70
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
71
|
+
altValue = _useState10[0],
|
|
72
|
+
setAltValue = _useState10[1];
|
|
73
|
+
var translatePlaceholderSelected = function translatePlaceholderSelected() {
|
|
74
|
+
if (activeLang == 'ru') return 'Выберите видео';
|
|
75
|
+
if (activeLang == 'en') return 'Select an video';
|
|
76
|
+
if (activeLang == 'tr') return "Bir resim seçin";
|
|
77
|
+
return 'Выберите видео';
|
|
78
|
+
};
|
|
79
|
+
(0, _react.useImperativeHandle)(ref, function () {
|
|
80
|
+
return {
|
|
81
|
+
error: error,
|
|
82
|
+
// прикрутить открытие системного диалога с выбором изображения
|
|
83
|
+
focus: function focus() {},
|
|
84
|
+
data: objImg
|
|
85
|
+
};
|
|
86
|
+
}, [objImg]);
|
|
87
|
+
var debounceChange = (0, _useDebounce.useDebounce)(changeContent, 1000);
|
|
88
|
+
(0, _react.useEffect)(function () {
|
|
89
|
+
debounceChange(id, [objImg]);
|
|
90
|
+
setContentArr(function (prev) {
|
|
91
|
+
return prev.map(function (el) {
|
|
92
|
+
if ((el === null || el === void 0 ? void 0 : el.block_id) == id) {
|
|
93
|
+
return _objectSpread(_objectSpread({}, el), {}, {
|
|
94
|
+
content: [objImg]
|
|
95
|
+
});
|
|
96
|
+
} else {
|
|
97
|
+
return el;
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
}, [objImg]);
|
|
102
|
+
var fetchPostVideo = function fetchPostVideo(file) {
|
|
103
|
+
var fd = new FormData();
|
|
104
|
+
fd.append('videos', file);
|
|
105
|
+
var url = "https://dl.ecomru.ru:6001/clients/videos";
|
|
106
|
+
var token = cookies.get('auth');
|
|
107
|
+
var requestHeaders = {
|
|
108
|
+
'Accept': 'application/json',
|
|
109
|
+
'Cache-control': 'no-cache',
|
|
110
|
+
'Authorization': "Bearer ".concat(token)
|
|
111
|
+
};
|
|
112
|
+
fetch(url, {
|
|
113
|
+
body: fd,
|
|
114
|
+
method: 'POST',
|
|
115
|
+
headers: requestHeaders
|
|
116
|
+
}).then(function (res) {
|
|
117
|
+
if (res.status === 200) {
|
|
118
|
+
return res.json();
|
|
119
|
+
} else {
|
|
120
|
+
throw new Error('bad response');
|
|
121
|
+
}
|
|
122
|
+
}).then(function (json) {
|
|
123
|
+
if (json.videos) {
|
|
124
|
+
var _json$videos, _json$videos2;
|
|
125
|
+
console.log((_json$videos = json.videos) === null || _json$videos === void 0 || (_json$videos = _json$videos[0]) === null || _json$videos === void 0 ? void 0 : _json$videos.url);
|
|
126
|
+
setObjImg({
|
|
127
|
+
value: (_json$videos2 = json.videos) === null || _json$videos2 === void 0 || (_json$videos2 = _json$videos2[0]) === null || _json$videos2 === void 0 ? void 0 : _json$videos2.url,
|
|
128
|
+
properties: {
|
|
129
|
+
alt: altValue
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
console.log(objImg);
|
|
133
|
+
// debounceChange({ value: json.videos?.[0]?.url, type: ARTICLE_TYPES.video, place: position }, ARTICLE_TYPES.video)
|
|
134
|
+
}
|
|
135
|
+
})["catch"](function (err) {
|
|
136
|
+
console.error(err);
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
var handleImageClick = function handleImageClick(e) {
|
|
140
|
+
if (readonly) {
|
|
141
|
+
var html = document.querySelector('html');
|
|
142
|
+
html.style = 'overflow: hidden';
|
|
143
|
+
setOpen(!isOpen);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
if (fileInputRef.current) {
|
|
147
|
+
fileInputRef.current.click();
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
var handleFileInput = function handleFileInput(e) {
|
|
151
|
+
console.log(e);
|
|
152
|
+
if (e.target.files.length === 0) {
|
|
153
|
+
e.preventDefault();
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
var fileBase64Reader = new FileReader();
|
|
157
|
+
fileBase64Reader.onload = function () {
|
|
158
|
+
var _fileBase64Reader$res, _extensionAndBase64$;
|
|
159
|
+
var re = /;base64,/;
|
|
160
|
+
var extensionAndBase64 = (_fileBase64Reader$res = fileBase64Reader.result) === null || _fileBase64Reader$res === void 0 ? void 0 : _fileBase64Reader$res.split(re);
|
|
161
|
+
var onlyExtension = (_extensionAndBase64$ = extensionAndBase64[0]) === null || _extensionAndBase64$ === void 0 ? void 0 : _extensionAndBase64$.split('image/')[1];
|
|
162
|
+
setExtension(onlyExtension);
|
|
163
|
+
fetchPostVideo(e.target.files[0]);
|
|
164
|
+
};
|
|
165
|
+
fileBase64Reader.readAsDataURL(e.target.files[0]);
|
|
166
|
+
setError(false);
|
|
167
|
+
onChange();
|
|
168
|
+
};
|
|
169
|
+
(0, _react.useEffect)(function () {
|
|
170
|
+
var _data$2, _data$3;
|
|
171
|
+
setObjImg({
|
|
172
|
+
value: (_data$2 = data[0]) === null || _data$2 === void 0 ? void 0 : _data$2.value,
|
|
173
|
+
properties: {
|
|
174
|
+
alt: (_data$3 = data[0]) === null || _data$3 === void 0 || (_data$3 = _data$3.properties) === null || _data$3 === void 0 ? void 0 : _data$3.alt
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
}, []);
|
|
178
|
+
|
|
179
|
+
// удалить
|
|
180
|
+
var handleDeleteBlock = function handleDeleteBlock(e) {
|
|
181
|
+
// setContent(e.currentTarget.textContent)
|
|
182
|
+
setContentArr(function (prev) {
|
|
183
|
+
return prev.filter(function (el) {
|
|
184
|
+
if ((el === null || el === void 0 ? void 0 : el.block_id) != id) {
|
|
185
|
+
return el;
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
deleteBlock(id);
|
|
190
|
+
};
|
|
191
|
+
(0, _react.useEffect)(function () {
|
|
192
|
+
if (!isOpen) {
|
|
193
|
+
var html = document.querySelector('html');
|
|
194
|
+
html.style = 'overflow: unset';
|
|
195
|
+
}
|
|
196
|
+
}, [isOpen]);
|
|
197
|
+
(0, _react.useEffect)(function () {
|
|
198
|
+
setCurrentIndex(ind);
|
|
199
|
+
setBeforeBlock(before);
|
|
200
|
+
}, []);
|
|
201
|
+
return /*#__PURE__*/_react["default"].createElement(_EditWrapper.EditWrapper, {
|
|
202
|
+
id: id,
|
|
203
|
+
before: before,
|
|
204
|
+
articleId: articleId,
|
|
205
|
+
changeBlock: changeBlock,
|
|
206
|
+
readonly: readonly,
|
|
207
|
+
draggableElement: draggableElement,
|
|
208
|
+
setDraggableElement: setDraggableElement,
|
|
209
|
+
fetchDataById: fetchDataById,
|
|
210
|
+
deleteFunc: function deleteFunc(e) {
|
|
211
|
+
return handleDeleteBlock(id);
|
|
212
|
+
},
|
|
213
|
+
type: "video",
|
|
214
|
+
child: /*#__PURE__*/_react["default"].createElement("div", {
|
|
215
|
+
className: "video-container",
|
|
216
|
+
onClick: function onClick(e) {
|
|
217
|
+
setCurrentIndex(ind);
|
|
218
|
+
setBeforeBlock(before);
|
|
219
|
+
},
|
|
220
|
+
onContextMenu: function onContextMenu(e) {
|
|
221
|
+
if (!readonly) {
|
|
222
|
+
e.preventDefault();
|
|
223
|
+
setCurrentIndex(ind);
|
|
224
|
+
setIsModal(true);
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
tabIndex: 0
|
|
228
|
+
}, /*#__PURE__*/_react["default"].createElement("button", {
|
|
229
|
+
className: !readonly ? 'video-container__button' : 'video-container__button__readonly',
|
|
230
|
+
onClick: handleImageClick
|
|
231
|
+
}, /*#__PURE__*/_react["default"].createElement("video", {
|
|
232
|
+
className: "video-container__video",
|
|
233
|
+
src: objImg !== null && objImg !== void 0 && objImg.value ? objImg === null || objImg === void 0 ? void 0 : objImg.value : '',
|
|
234
|
+
controls: true
|
|
235
|
+
}, /*#__PURE__*/_react["default"].createElement("source", null)), !(objImg !== null && objImg !== void 0 && objImg.value) && /*#__PURE__*/_react["default"].createElement("div", {
|
|
236
|
+
className: "hidden-placeholder"
|
|
237
|
+
}, /*#__PURE__*/_react["default"].createElement("p", {
|
|
238
|
+
className: "text"
|
|
239
|
+
}, translatePlaceholderSelected()))), !(objImg !== null && objImg !== void 0 && objImg.value) && /*#__PURE__*/_react["default"].createElement("input", {
|
|
240
|
+
name: "uploadedImage",
|
|
241
|
+
ref: fileInputRef,
|
|
242
|
+
className: "video-container__file-input",
|
|
243
|
+
type: "file",
|
|
244
|
+
onChange: handleFileInput
|
|
245
|
+
// accept='image/png, image/jpeg'
|
|
246
|
+
}))
|
|
247
|
+
});
|
|
248
|
+
});
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
// @import url('../../../font.scss');
|
|
2
|
+
|
|
3
|
+
.video-container {
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
justify-content: center;
|
|
7
|
+
height: 100%;
|
|
8
|
+
max-height: 100%;
|
|
9
|
+
width: auto;
|
|
10
|
+
max-width: 100%;
|
|
11
|
+
border-radius: 10px;
|
|
12
|
+
overflow: hidden;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
|
|
15
|
+
&__video {
|
|
16
|
+
width: 100%;
|
|
17
|
+
height: auto;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.video-container__button__readonly,
|
|
21
|
+
.video-container__button {
|
|
22
|
+
display: flex;
|
|
23
|
+
border: none;
|
|
24
|
+
background-color: inherit;
|
|
25
|
+
display: flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
justify-content: center;
|
|
28
|
+
height: 100%;
|
|
29
|
+
position: relative;
|
|
30
|
+
|
|
31
|
+
.video {
|
|
32
|
+
width: 100%;
|
|
33
|
+
height: 100%;
|
|
34
|
+
object-fit: contain;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.hidden-placeholder {
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
width: 100%;
|
|
42
|
+
height: 100%;
|
|
43
|
+
position: absolute;
|
|
44
|
+
top: 0;
|
|
45
|
+
left: 0;
|
|
46
|
+
right: 0;
|
|
47
|
+
bottom: 0;
|
|
48
|
+
z-index: 1;
|
|
49
|
+
background-color: white;
|
|
50
|
+
opacity: 0.5;
|
|
51
|
+
transition: 0.3s;
|
|
52
|
+
opacity: 0;
|
|
53
|
+
visibility: hidden;
|
|
54
|
+
cursor: pointer;
|
|
55
|
+
|
|
56
|
+
.text {
|
|
57
|
+
color: #2B2B46;
|
|
58
|
+
font-family: "Golos Text";
|
|
59
|
+
font-size: 32px;
|
|
60
|
+
line-height: 1.1;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&:hover {
|
|
65
|
+
.hidden-placeholder {
|
|
66
|
+
visibility: visible;
|
|
67
|
+
opacity: 0.5;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
.blackout {
|
|
77
|
+
display: flex;
|
|
78
|
+
width: 100%;
|
|
79
|
+
height: 100%;
|
|
80
|
+
min-height: 100vh;
|
|
81
|
+
z-index: 10;
|
|
82
|
+
position: fixed;
|
|
83
|
+
overflow: auto;
|
|
84
|
+
align-items: center;
|
|
85
|
+
justify-content: center;
|
|
86
|
+
background-color: rgb(0, 0, 0, 0.3);
|
|
87
|
+
padding: 20px;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.video-box {
|
|
91
|
+
width: 100%;
|
|
92
|
+
height: 100%;
|
|
93
|
+
|
|
94
|
+
.video {
|
|
95
|
+
width: 100%;
|
|
96
|
+
height: 100%;
|
|
97
|
+
object-fit: contain;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
&__placeholder {
|
|
102
|
+
width: 200px;
|
|
103
|
+
height: 200px;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
&__button {
|
|
107
|
+
min-width: 100%;
|
|
108
|
+
position: relative;
|
|
109
|
+
top: 0;
|
|
110
|
+
bottom: 0;
|
|
111
|
+
left: 0;
|
|
112
|
+
right: 0;
|
|
113
|
+
z-index: 0;
|
|
114
|
+
border: none;
|
|
115
|
+
border-radius: 16px;
|
|
116
|
+
background-color: unset;
|
|
117
|
+
min-height: 100px;
|
|
118
|
+
|
|
119
|
+
&__placeholder {
|
|
120
|
+
display: flex;
|
|
121
|
+
width: 400px;
|
|
122
|
+
height: 400px;
|
|
123
|
+
justify-content: center;
|
|
124
|
+
align-items: center;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
&__file-input {
|
|
129
|
+
position: absolute;
|
|
130
|
+
opacity: 0;
|
|
131
|
+
visibility: hidden;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
&__video {
|
|
135
|
+
display: inline-block;
|
|
136
|
+
max-width: 100%;
|
|
137
|
+
width: 100%;
|
|
138
|
+
height: auto;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
&__video-placeholder {
|
|
142
|
+
display: inline-block;
|
|
143
|
+
max-width: 100%;
|
|
144
|
+
width: 100%;
|
|
145
|
+
height: auto;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.ButtonActionDrop = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _bxDotsHorizontalRounded = _interopRequireDefault(require("./img/bx-dots-horizontal-rounded.svg"));
|
|
11
|
+
require("./ButtonActionDrop.scss");
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
13
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
14
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
15
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
16
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
17
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
18
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
19
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
20
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
21
|
+
var ButtonActionDrop = exports.ButtonActionDrop = function ButtonActionDrop(_ref) {
|
|
22
|
+
var _ref$btns = _ref.btns,
|
|
23
|
+
btns = _ref$btns === void 0 ? [] : _ref$btns,
|
|
24
|
+
_ref$label = _ref.label,
|
|
25
|
+
label = _ref$label === void 0 ? '' : _ref$label,
|
|
26
|
+
size = _ref.size,
|
|
27
|
+
color = _ref.color,
|
|
28
|
+
positionDrop = _ref.positionDrop,
|
|
29
|
+
_ref$id = _ref.id,
|
|
30
|
+
id = _ref$id === void 0 ? 1 : _ref$id;
|
|
31
|
+
var _useState = (0, _react.useState)(false),
|
|
32
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
33
|
+
isDrop = _useState2[0],
|
|
34
|
+
setIsDrop = _useState2[1];
|
|
35
|
+
var _useState3 = (0, _react.useState)(0),
|
|
36
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
37
|
+
top = _useState4[0],
|
|
38
|
+
setTop = _useState4[1];
|
|
39
|
+
var _useState5 = (0, _react.useState)(0),
|
|
40
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
41
|
+
left = _useState6[0],
|
|
42
|
+
setLeft = _useState6[1];
|
|
43
|
+
var ref = (0, _react.useRef)();
|
|
44
|
+
|
|
45
|
+
// Обработчик на клик вне элемента
|
|
46
|
+
(0, _react.useEffect)(function () {
|
|
47
|
+
var isDrop = function isDrop(e) {
|
|
48
|
+
var el = e.target;
|
|
49
|
+
if (!el.closest("#button-action-drop-".concat(label + id))) {
|
|
50
|
+
setIsDrop(false);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
document.addEventListener('click', isDrop);
|
|
54
|
+
return function () {
|
|
55
|
+
document.removeEventListener('click', isDrop);
|
|
56
|
+
};
|
|
57
|
+
}, []);
|
|
58
|
+
(0, _react.useEffect)(function () {
|
|
59
|
+
var ref_top = ref === null || ref === void 0 ? void 0 : ref.current.getBoundingClientRect().bottom;
|
|
60
|
+
var ref_left = ref === null || ref === void 0 ? void 0 : ref.current.getBoundingClientRect().right;
|
|
61
|
+
setLeft(ref_left);
|
|
62
|
+
setTop(ref_top);
|
|
63
|
+
}, [isDrop]);
|
|
64
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
65
|
+
className: "button-action-drop",
|
|
66
|
+
id: "button-action-drop-".concat(label + id),
|
|
67
|
+
onClick: function onClick(e) {
|
|
68
|
+
e.stopPropagation();
|
|
69
|
+
setIsDrop(!isDrop);
|
|
70
|
+
var el = e.target;
|
|
71
|
+
if (el.classList.contains("#button-action-drop-".concat(label + id))) {
|
|
72
|
+
setIsDrop(false);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}, /*#__PURE__*/_react["default"].createElement("button", {
|
|
76
|
+
ref: ref,
|
|
77
|
+
style: {
|
|
78
|
+
background: color ? color : ''
|
|
79
|
+
},
|
|
80
|
+
className: "button-action-drop__btn ".concat(size === 'm' ? 'button-action-drop__btn-medium' : '', " ").concat(size === 's' ? 'button-action-drop__btn-small' : '')
|
|
81
|
+
}, /*#__PURE__*/_react["default"].createElement("img", {
|
|
82
|
+
src: _bxDotsHorizontalRounded["default"]
|
|
83
|
+
})), isDrop && /*#__PURE__*/_react["default"].createElement("div", {
|
|
84
|
+
className: 'button-action-drop__drop-menu_active',
|
|
85
|
+
style: {
|
|
86
|
+
left: left ? left - 160 : 0,
|
|
87
|
+
top: top ? top : 0
|
|
88
|
+
}
|
|
89
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
90
|
+
className: "button-action-drop__drop-menu-inside",
|
|
91
|
+
onMouseLeave: function onMouseLeave() {
|
|
92
|
+
return setIsDrop(false);
|
|
93
|
+
}
|
|
94
|
+
}, btns.map(function (_ref2) {
|
|
95
|
+
var btn = _ref2.btn,
|
|
96
|
+
func = _ref2.func;
|
|
97
|
+
return /*#__PURE__*/_react["default"].createElement("button", {
|
|
98
|
+
className: "button-action-drop__drop-menu__btn",
|
|
99
|
+
onClick: function onClick(e) {
|
|
100
|
+
if (id) {
|
|
101
|
+
func(id);
|
|
102
|
+
} else {
|
|
103
|
+
func(e);
|
|
104
|
+
}
|
|
105
|
+
setIsDrop(false);
|
|
106
|
+
}
|
|
107
|
+
}, btn);
|
|
108
|
+
}))));
|
|
109
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
.button-action-drop {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
justify-content: center;
|
|
5
|
+
position: relative;
|
|
6
|
+
|
|
7
|
+
&__btn,
|
|
8
|
+
&__btn-medium {
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
width: 100%;
|
|
13
|
+
height: 100%;
|
|
14
|
+
border-radius: 8px;
|
|
15
|
+
background: #FAFBFA;
|
|
16
|
+
border: none;
|
|
17
|
+
width: 40px;
|
|
18
|
+
min-width: 40px;
|
|
19
|
+
height: 40px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&__btn-medium {
|
|
23
|
+
border-radius: 4px;
|
|
24
|
+
width: 32px;
|
|
25
|
+
min-width: 32px;
|
|
26
|
+
height: 32px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&__btn-small {
|
|
30
|
+
border-radius: 4px;
|
|
31
|
+
width: 16px;
|
|
32
|
+
min-width: 16px;
|
|
33
|
+
height: 16px;
|
|
34
|
+
|
|
35
|
+
img {
|
|
36
|
+
transform: rotate(90deg);
|
|
37
|
+
width: 14px;
|
|
38
|
+
height: 14px;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&__drop-menu,
|
|
43
|
+
&__drop-menu_active {
|
|
44
|
+
position: fixed;
|
|
45
|
+
top: 0;
|
|
46
|
+
left: 0;
|
|
47
|
+
width: 160px;
|
|
48
|
+
height: auto;
|
|
49
|
+
display: flex;
|
|
50
|
+
flex-direction: column;
|
|
51
|
+
overflow: hidden;
|
|
52
|
+
// opacity: 0;
|
|
53
|
+
visibility: hidden;
|
|
54
|
+
// transition: 0.3s;
|
|
55
|
+
z-index: 5;
|
|
56
|
+
z-index: 100;
|
|
57
|
+
padding-top: 6px;
|
|
58
|
+
|
|
59
|
+
&_active {
|
|
60
|
+
opacity: 1;
|
|
61
|
+
visibility: visible;
|
|
62
|
+
// transition: 0.3s;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&__btn {
|
|
66
|
+
padding: 8px;
|
|
67
|
+
width: 100%;
|
|
68
|
+
min-height: 32px;
|
|
69
|
+
background-color: inherit;
|
|
70
|
+
border: none;
|
|
71
|
+
text-align: left;
|
|
72
|
+
color: #3A3A3A;
|
|
73
|
+
font-family: NunitoSans;
|
|
74
|
+
font-size: 13px;
|
|
75
|
+
font-style: normal;
|
|
76
|
+
font-weight: 400;
|
|
77
|
+
line-height: 14px;
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
&:hover {
|
|
81
|
+
// transition: 0.3s;
|
|
82
|
+
background-color: #F3F3F3;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
&__drop-menu-inside {
|
|
88
|
+
display: flex;
|
|
89
|
+
flex-direction: column;
|
|
90
|
+
border-radius: 8px;
|
|
91
|
+
border: 1px solid #E0E7F2;
|
|
92
|
+
background: #fff;
|
|
93
|
+
box-shadow: 0px 4px 4px 0px rgba(30, 41, 59, 0.06);
|
|
94
|
+
padding-top: 4px;
|
|
95
|
+
padding-bottom: 4px;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M12 10C10.9 10 10 10.9 10 12C10 13.1 10.9 14 12 14C13.1 14 14 13.1 14 12C14 10.9 13.1 10 12 10ZM18 10C16.9 10 16 10.9 16 12C16 13.1 16.9 14 18 14C19.1 14 20 13.1 20 12C20 10.9 19.1 10 18 10ZM6 10C4.9 10 4 10.9 4 12C4 13.1 4.9 14 6 14C7.1 14 8 13.1 8 12C8 10.9 7.1 10 6 10Z" fill="#636D65"/>
|
|
3
|
+
</svg>
|