ecomlab-components-next 0.1.32 → 0.1.34

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.
Files changed (105) hide show
  1. package/dist/common/fetchUrls.js +7 -2
  2. package/dist/common/headers.js +2 -1
  3. package/dist/common/hooks/useDebounce.js +37 -0
  4. package/dist/common/hooks/useTextSelectionInModal.js +41 -0
  5. package/dist/components/Article/ArcticleWiki/ArcticleWiki.stories.js +152 -0
  6. package/dist/components/Article/ArcticleWiki/ArticleWiki.js +775 -0
  7. package/dist/components/Article/ArcticleWiki/ArticleWiki.scss +278 -0
  8. package/dist/components/Article/ArticleViewV2/ArticleViewV2.js +791 -0
  9. package/dist/components/Article/ArticleViewV2/ArticleViewV2.scss +245 -0
  10. package/dist/components/Article/ArticleViewV2/ArticleViewV2.stories.js +166 -0
  11. package/dist/components/Article/ArticleViewV2/img/bell.svg +9 -0
  12. package/dist/components/Article/ArticleViewV2/img/btn-add-round.svg +4 -0
  13. package/dist/components/Article/ArticleViewV2/img/calendar_icon.svg +6 -0
  14. package/dist/components/Article/ArticleViewV2/img/close-round.svg +3 -0
  15. package/dist/components/Article/ArticleViewV2/img/close.svg +9 -0
  16. package/dist/components/Article/ArticleViewV2/img/copy_icon.svg +5 -0
  17. package/dist/components/Article/ArticleViewV2/img/dndMenu.svg +1 -0
  18. package/dist/components/Article/ArticleViewV2/img/info.svg +9 -0
  19. package/dist/components/Article/ArticleViewV2/img/ok_icon.svg +5 -0
  20. package/dist/components/Article/ArticleViewV2/img/plus_circle.svg +6 -0
  21. package/dist/components/Article/ArticleViewV2/img/share_icon.svg +5 -0
  22. package/dist/components/Article/ArticleViewV2/img/tg.svg +3 -0
  23. package/dist/components/Article/ArticleViewV2/img/tg_icon.svg +5 -0
  24. package/dist/components/Article/ArticleViewV2/img/time_icon.svg +6 -0
  25. package/dist/components/Article/ArticleViewV2/img/view_icon.svg +6 -0
  26. package/dist/components/Article/ArticleViewV2/img/vk_icon.svg +5 -0
  27. package/dist/components/Article/ArticleViewV2/img/whatsapp_icon.svg +5 -0
  28. package/dist/components/Article/Breadcrumb/Breadcrumb.js +69 -0
  29. package/dist/components/Article/Breadcrumb/Breadcrumb.scss +96 -0
  30. package/dist/components/Article/Breadcrumb/img/drop-right.svg +3 -0
  31. package/dist/components/Article/Breadcrumb/img/home_icon.svg +5 -0
  32. package/dist/components/Article/EditWrapper/EditWrapper.js +108 -0
  33. package/dist/components/Article/EditWrapper/EditWrapper.scss +93 -0
  34. package/dist/components/Article/EditWrapper/img/bx-grid-vertical.svg +5 -0
  35. package/dist/components/Article/Editor/Editor.js +92 -0
  36. package/dist/components/Article/Editor/Editor.scss +35 -0
  37. package/dist/components/Article/Editor/img/copy.svg +6 -0
  38. package/dist/components/Article/FormBtn/FormBtn.js +229 -0
  39. package/dist/components/Article/FormBtn/FormBtn.scss +458 -0
  40. package/dist/components/Article/FormBtn/ModalBitrixForm/ModalBitrixForm.js +282 -0
  41. package/dist/components/Article/FormBtn/ModalBitrixForm/ModalBitrixForm.scss +140 -0
  42. package/dist/components/Article/FormBtn/ModalBitrixForm/img/close_icon.svg +3 -0
  43. package/dist/components/Article/FormBtn/ModalBitrixForm/img/done_icon.svg +3 -0
  44. package/dist/components/Article/FormBtn/ModalBitrixForm/img/ozon.svg +9 -0
  45. package/dist/components/Article/FormBtn/ModalBitrixForm/img/ozon_bkg.svg +9 -0
  46. package/dist/components/Article/FormBtn/ModalBitrixForm/validationFunc.js +14 -0
  47. package/dist/components/Article/FormBtn/img/clos_icon.svg +6 -0
  48. package/dist/components/Article/FormBtn/img/close-icon.svg +3 -0
  49. package/dist/components/Article/ImgArticle/ImgArticle.js +297 -0
  50. package/dist/components/Article/ImgArticle/ImgArticle.scss +169 -0
  51. package/dist/components/Article/ImgArticle/img/noPhoto.png +0 -0
  52. package/dist/components/Article/InformationBlock/InformationBlock.js +200 -0
  53. package/dist/components/Article/InformationBlock/InformationBlock.scss +89 -0
  54. package/dist/components/Article/InformationBlock/img/bell.svg +9 -0
  55. package/dist/components/Article/ListOfContent/ListOfContent.js +110 -0
  56. package/dist/components/Article/ListOfContent/ListOfContent.scss +115 -0
  57. package/dist/components/Article/ListOfContent/img/time_icon.svg +3 -0
  58. package/dist/components/Article/ListOfContent/img/view_icon.svg +3 -0
  59. package/dist/components/Article/ModalMiltilevelSidebarSettings/ModalMiltilevelSidebarSettings.js +973 -0
  60. package/dist/components/Article/ModalMiltilevelSidebarSettings/ModalMiltilevelSidebarSettings.scss +254 -0
  61. package/dist/components/Article/ModalMiltilevelSidebarSettings/ModalMiltilevelSidebarSettings.stories.js +76 -0
  62. package/dist/components/Article/ModalMiltilevelSidebarSettings/img/bx-cog.png +0 -0
  63. package/dist/components/Article/ModalMiltilevelSidebarSettings/img/bx-cog.svg +4 -0
  64. package/dist/components/Article/ModalMiltilevelSidebarSettings/img/bx-trash.png +0 -0
  65. package/dist/components/Article/ModalMiltilevelSidebarSettings/img/bx-trash.svg +4 -0
  66. package/dist/components/Article/ModalMiltilevelSidebarSettings/img/drop_icon.svg +5 -0
  67. package/dist/components/Article/ModalMiltilevelSidebarSettings/img/edit_icon.svg +6 -0
  68. package/dist/components/Article/ModalMiltilevelSidebarSettings/img/trash_icon.svg +8 -0
  69. package/dist/components/Article/ModalReplaceBlock/ModalReplaceBlock.js +85 -0
  70. package/dist/components/Article/ModalReplaceBlock/ModalReplaceBlock.scss +72 -0
  71. package/dist/components/Article/SelectedBlocks/SelectedBlocks.js +281 -0
  72. package/dist/components/Article/SelectedBlocks/SelectedBlocks.scss +0 -0
  73. package/dist/components/Article/SocialMedia/ModalSelectionSocialMedia/ModalSelectionSocialMedia.js +130 -0
  74. package/dist/components/Article/SocialMedia/ModalSelectionSocialMedia/ModalSelectionSocialMedia.scss +65 -0
  75. package/dist/components/Article/SocialMedia/ModalSelectionSocialMedia/img/Facebook.svg +4 -0
  76. package/dist/components/Article/SocialMedia/ModalSelectionSocialMedia/img/OK.svg +4 -0
  77. package/dist/components/Article/SocialMedia/ModalSelectionSocialMedia/img/Xcom.svg +9 -0
  78. package/dist/components/Article/SocialMedia/ModalSelectionSocialMedia/img/linkedin.svg +5 -0
  79. package/dist/components/Article/SocialMedia/ModalSelectionSocialMedia/img/tg.svg +4 -0
  80. package/dist/components/Article/SocialMedia/ModalSelectionSocialMedia/img/vk.svg +4 -0
  81. package/dist/components/Article/SocialMedia/ModalSelectionSocialMedia/img/wtsp.svg +4 -0
  82. package/dist/components/Article/SocialMedia/SocialMedia.js +242 -0
  83. package/dist/components/Article/SocialMedia/SocialMedia.scss +57 -0
  84. package/dist/components/Article/SocialMedia/img/dzen.svg +4 -0
  85. package/dist/components/Article/SocialMedia/img/facebook.svg +4 -0
  86. package/dist/components/Article/SocialMedia/img/insta.svg +9 -0
  87. package/dist/components/Article/SocialMedia/img/linkendIn.svg +5 -0
  88. package/dist/components/Article/SocialMedia/img/ok.svg +4 -0
  89. package/dist/components/Article/SocialMedia/img/pikabu.svg +9 -0
  90. package/dist/components/Article/SocialMedia/img/telegram.svg +4 -0
  91. package/dist/components/Article/SocialMedia/img/vcru.svg +0 -0
  92. package/dist/components/Article/SocialMedia/img/vk.svg +4 -0
  93. package/dist/components/Article/SocialMedia/img/wp.svg +4 -0
  94. package/dist/components/Article/SocialMedia/img/x.svg +9 -0
  95. package/dist/components/Article/TextArticle/TextArticle.js +257 -0
  96. package/dist/components/Article/TextArticle/TextArticle.scss +156 -0
  97. package/dist/components/Article/TextArticle/img/dndMenu.svg +1 -0
  98. package/dist/components/Article/TitleText/TitleText.js +157 -0
  99. package/dist/components/Article/TitleText/TitleText.scss +74 -0
  100. package/dist/components/Article/VideoArticle/VideoArticle.js +248 -0
  101. package/dist/components/Article/VideoArticle/VideoArticle.scss +147 -0
  102. package/dist/components/Buttons/ButtonActionDrop/ButtonActionDrop.js +109 -0
  103. package/dist/components/Buttons/ButtonActionDrop/ButtonActionDrop.scss +97 -0
  104. package/dist/components/Buttons/ButtonActionDrop/img/bx-dots-horizontal-rounded.svg +3 -0
  105. package/package.json +3 -2
@@ -0,0 +1,257 @@
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.TextArticle = void 0;
9
+ var _react = _interopRequireWildcard(require("react"));
10
+ var _EditWrapper = require("../EditWrapper/EditWrapper");
11
+ var _useDebounce = require("../../../common/hooks/useDebounce");
12
+ var _Editor = require("../Editor/Editor");
13
+ var _htmlReactParser = _interopRequireDefault(require("html-react-parser"));
14
+ require("./TextArticle.scss");
15
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
16
+ 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); }
17
+ 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; }
18
+ 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; }
19
+ 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; }
20
+ 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; }
21
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
22
+ 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); }
23
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
24
+ 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."); }
25
+ 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; } }
26
+ 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; }
27
+ 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; } }
28
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
29
+ // const TextEditor = () => {
30
+ // const [content, setContent] = useState('<p><a href="https://apps0.ecomru.ru:4453/docs#/" target="_blank" style="color: blue;">Методы</a>&nbsp;для <u><font color="#e0ad2e">редактора</font></u><b style=""><u style=""><font color="#e0ad2e"></font></u></b></p>');
31
+ // const [finalHTML, setFinalHTML] = useState('');
32
+ // const editorRef = useRef(null);
33
+
34
+ // // Функция для изменения жирности текста
35
+ // const toggleBold = () => {
36
+ // document.execCommand('bold');
37
+ // };
38
+
39
+ // // Функция для изменения курсива текста
40
+ // const toggleItalic = () => {
41
+ // document.execCommand('italic');
42
+ // };
43
+
44
+ // // Функция для изменения курсива текста
45
+ // const toggleUnderline = () => {
46
+ // document.execCommand('underline');
47
+ // };
48
+
49
+ // // Функция для изменения цвета текста
50
+ // const changeTextColor = () => {
51
+ // const color = prompt('Введите цвет для текста (например, red, #ff5733):', 'rgb(224, 173, 46)');
52
+ // if (color) {
53
+ // document.execCommand('foreColor', false, color); // Изменяем цвет текста
54
+ // }
55
+ // };
56
+
57
+ // // Функция для обновления содержимого редактора
58
+ // const handleChange = () => {
59
+ // if (editorRef.current) {
60
+ // // setContent(editorRef.current.innerHTML); // Обновляем состояние содержимого редактора
61
+ // }
62
+ // };
63
+
64
+ // // Функция для записи итоговой разметки
65
+ // const saveHTML = () => {
66
+ // setFinalHTML(editorRef.current.innerHTML); // Сохраняем текущую разметку в состояние finalHTML
67
+ // };
68
+
69
+ // // Функция для добавления текста и ссылки
70
+ // const insertLink = () => {
71
+ // const url = prompt('Введите URL ссылки:', 'https://example.com');
72
+ // const linkText = prompt('Введите текст ссылки:', 'Текст ссылки');
73
+
74
+ // if (url && linkText) {
75
+ // const selection = window.getSelection();
76
+ // const range = selection.getRangeAt(0);
77
+ // const linkNode = document.createElement('a');
78
+ // linkNode.href = url;
79
+ // linkNode.target = '_blank';
80
+ // linkNode.textContent = linkText;
81
+ // linkNode.style.color = 'blue';
82
+
83
+ // range.deleteContents(); // Удаляем выбранный текст
84
+ // range.insertNode(linkNode); // Вставляем ссылку
85
+ // }
86
+ // };
87
+
88
+ // return (
89
+ // <div>
90
+ // <div>
91
+ // <button onClick={toggleBold}>Жирный</button>
92
+ // <button onClick={toggleItalic}>Курсив</button>
93
+ // <button onClick={toggleUnderline}>Подчеркивание</button>
94
+ // <button onClick={changeTextColor}>Цвет текста</button>
95
+ // <button onClick={saveHTML}>Сохранить разметку</button>
96
+ // <button onClick={insertLink}>Вставить ссылку</button>
97
+ // </div>
98
+
99
+ // <div
100
+ // contentEditable="true"
101
+ // ref={editorRef}
102
+ // onInput={handleChange}
103
+ // style={{
104
+ // border: '1px solid #ccc',
105
+ // padding: '10px',
106
+ // minHeight: '200px',
107
+ // }}
108
+ // dangerouslySetInnerHTML={{ __html: content }}
109
+ // />
110
+
111
+ // <div>
112
+ // <h3>Результат:</h3>
113
+ // <pre>{parse(finalHTML.toString())}</pre>
114
+ // </div>
115
+
116
+ // <div>
117
+ // <h3>Итоговая разметка HTML:</h3>
118
+ // <pre>{finalHTML}</pre>
119
+ // </div>
120
+ // </div>
121
+ // );
122
+ // };
123
+
124
+ // export default TextEditor;
125
+
126
+ var TextArticle = exports.TextArticle = function TextArticle(_ref) {
127
+ var _data$, _data$2;
128
+ var id = _ref.id,
129
+ data = _ref.data,
130
+ changeContent = _ref.changeContent,
131
+ setIsModal = _ref.setIsModal,
132
+ ind = _ref.ind,
133
+ setCurrentIndex = _ref.setCurrentIndex,
134
+ before = _ref.before,
135
+ setBeforeBlock = _ref.setBeforeBlock,
136
+ setContentArr = _ref.setContentArr,
137
+ deleteBlock = _ref.deleteBlock,
138
+ changeBlock = _ref.changeBlock,
139
+ _ref$readonly = _ref.readonly,
140
+ readonly = _ref$readonly === void 0 ? false : _ref$readonly,
141
+ draggableElement = _ref.draggableElement,
142
+ setDraggableElement = _ref.setDraggableElement,
143
+ articleId = _ref.articleId,
144
+ fetchDataById = _ref.fetchDataById;
145
+ var _useState = (0, _react.useState)(data !== null && data !== void 0 && (_data$ = data[0]) !== null && _data$ !== void 0 && _data$.value ? data === null || data === void 0 || (_data$2 = data[0]) === null || _data$2 === void 0 ? void 0 : _data$2.value : ''),
146
+ _useState2 = _slicedToArray(_useState, 2),
147
+ content = _useState2[0],
148
+ setContent = _useState2[1];
149
+ var ref = (0, _react.useRef)();
150
+ var debounceChange = (0, _useDebounce.useDebounce)(changeContent, 1000);
151
+ var _useState3 = (0, _react.useState)({}),
152
+ _useState4 = _slicedToArray(_useState3, 2),
153
+ properties = _useState4[0],
154
+ setProperties = _useState4[1];
155
+ var handleInput = function handleInput(e) {
156
+ var _ref$current;
157
+ // setContent(e.currentTarget.textContent)
158
+ debounceChange(id, [{
159
+ value: ref === null || ref === void 0 || (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.innerHTML,
160
+ properties: properties
161
+ }]);
162
+ setContentArr(function (prev) {
163
+ return prev.map(function (el) {
164
+ if ((el === null || el === void 0 ? void 0 : el.block_id) == id) {
165
+ var _ref$current2;
166
+ return _objectSpread(_objectSpread({}, el), {}, {
167
+ content: [{
168
+ value: ref === null || ref === void 0 || (_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.innerHTML
169
+ }]
170
+ });
171
+ } else {
172
+ return el;
173
+ }
174
+ });
175
+ });
176
+ };
177
+ (0, _react.useEffect)(function () {
178
+ handleInput();
179
+ }, [properties, content]);
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
+
192
+ // Регулярное выражение для поиска ссылок, начинающихся с пробела или новой
193
+ // строки, и заканчивающихся перед пробелом или новой строкой
194
+ function wrapLinksInElement(str) {
195
+ var linkPattern = /(?:\s|\n)(https?:\/\/[^\s\n]+)/g;
196
+ return str.replace(linkPattern, function (match, p1) {
197
+ return " <a href=".concat(p1, " target='blank' download='download'>").concat(p1, "</a>");
198
+ });
199
+ }
200
+
201
+ // Вставка кода без форматирования
202
+ var handlePaste = function handlePaste(event) {
203
+ event.preventDefault(); // Отменяем стандартное поведение вставки
204
+ var text = event.clipboardData.getData('text/plain'); // Получаем только текст
205
+ document.execCommand('insertText', false, text); // Вставляем текст без форматирования
206
+ };
207
+ return /*#__PURE__*/_react["default"].createElement(_EditWrapper.EditWrapper, {
208
+ id: id,
209
+ before: before,
210
+ articleId: articleId,
211
+ changeBlock: changeBlock,
212
+ readonly: readonly,
213
+ draggableElement: draggableElement,
214
+ setDraggableElement: setDraggableElement,
215
+ fetchDataById: fetchDataById,
216
+ deleteFunc: function deleteFunc(e) {
217
+ return handleDeleteBlock(id);
218
+ },
219
+ type: "text",
220
+ child: /*#__PURE__*/_react["default"].createElement("div", {
221
+ style: {
222
+ display: 'flex',
223
+ flexDirection: 'column',
224
+ gap: '4px'
225
+ }
226
+ }, !readonly && /*#__PURE__*/_react["default"].createElement(_Editor.Editor, {
227
+ handleInput: handleInput
228
+ }), /*#__PURE__*/_react["default"].createElement("p", {
229
+ className: "article-text",
230
+ style: properties,
231
+ tabIndex: 0,
232
+ autoFocus: true,
233
+ shouldComponentUpdate: true,
234
+ suppressContentEditableWarning: true,
235
+ contentEditable: !readonly,
236
+ dangerouslySetInnerHTML: {
237
+ __html: content
238
+ },
239
+ ref: ref,
240
+ onInput: function onInput(e) {
241
+ return handleInput(e);
242
+ },
243
+ onContextMenu: function onContextMenu(e) {
244
+ if (!readonly) {
245
+ e.preventDefault();
246
+ setCurrentIndex(ind);
247
+ setIsModal(true);
248
+ }
249
+ },
250
+ onClick: function onClick(e) {
251
+ setCurrentIndex(ind);
252
+ setBeforeBlock(before);
253
+ },
254
+ onPaste: handlePaste
255
+ }))
256
+ });
257
+ };
@@ -0,0 +1,156 @@
1
+ // @import url('../../../font.scss');
2
+
3
+ .article-block-wrapper {
4
+ display: flex;
5
+
6
+ &__drag {
7
+ width: 8px;
8
+ height: 8px;
9
+ max-height: 8px;
10
+ border-radius: 50%;
11
+ background-color: #029CFD;
12
+ margin-top: 10px;
13
+ position: relative;
14
+ left: -8px;
15
+ cursor: grab;
16
+
17
+ }
18
+
19
+ &__close {
20
+ cursor: pointer;
21
+ margin-top: 10px;
22
+ width: 10px;
23
+ height: 10px;
24
+ background-color: rgb(0, 0, 0);
25
+ clip-path: polygon(20% 0%, 0% 20%, 30% 50%, 0% 80%, 20% 100%, 50% 70%, 80% 100%, 100% 80%, 70% 50%, 100% 20%, 80% 0%, 50% 30%);
26
+ }
27
+
28
+ &__text {
29
+ padding-bottom: 24px;
30
+ }
31
+
32
+ &__title {
33
+ padding: 32px 0px;
34
+
35
+ .article-block-wrapper {
36
+ &__drag {
37
+ margin-top: 20px;
38
+ }
39
+
40
+ &__close {
41
+ margin-top: 20px;
42
+ }
43
+ }
44
+ }
45
+ }
46
+
47
+ .article-text {
48
+ display: inline-block;
49
+ width: 100%;
50
+ color: #191919;
51
+ font-family: "Open Sans";
52
+ font-size: 18px;
53
+ font-style: normal;
54
+ font-weight: 400;
55
+ line-height: 1.6;
56
+ white-space: pre-wrap;
57
+ word-break: break-word;
58
+ padding: 0;
59
+
60
+ p,
61
+ span,
62
+ li {
63
+ color: inherit !important;
64
+ font-family: inherit !important;
65
+ font-size: inherit !important;
66
+ font-style: inherit !important;
67
+ font-weight: inherit !important;
68
+ line-height: inherit !important;
69
+ }
70
+
71
+ br {
72
+ content: "";
73
+ display: block;
74
+ height: 18px;
75
+ }
76
+
77
+ a {
78
+ color: #1890ff;
79
+ text-decoration: underline;
80
+ }
81
+
82
+ .link {
83
+ color: #029CFD;
84
+ text-decoration: underline;
85
+ }
86
+ }
87
+
88
+ .link_modal {
89
+ z-index: 1;
90
+ width: 100%;
91
+ // position: absolute;
92
+ bottom: 0;
93
+ padding: 8px;
94
+ background-color: #fff;
95
+
96
+ .link_modal_container {
97
+ display: flex;
98
+ align-items: center;
99
+ justify-content: center;
100
+ gap: 1em;
101
+ border-radius: 1em;
102
+ background: white;
103
+ width: 100%;
104
+
105
+ .link_modal_input {
106
+ border: 1px solid grey;
107
+ outline: 1px solid grey;
108
+ border-radius: .5em;
109
+ }
110
+ }
111
+
112
+ }
113
+
114
+ .article-text[contenteditable="true"] {
115
+ outline: none;
116
+
117
+
118
+ &:empty {
119
+ width: 100%;
120
+ // border: 1px solid red;
121
+
122
+ &::after {
123
+ content: "Введите текст";
124
+ color: #D9D9D9;
125
+ }
126
+ }
127
+ }
128
+
129
+ @media (max-width: 1100px) {
130
+ .article-text {
131
+ font-size: 18px !important;
132
+ }
133
+
134
+ .article-block-wrapper__text {
135
+ padding-bottom: 18px;
136
+ }
137
+
138
+ .article-block-wrapper__title {
139
+ padding: 24px 0px;
140
+ }
141
+ }
142
+
143
+ @media (max-width: 430px) {
144
+ .article-text {
145
+ font-size: 16px !important;
146
+ padding-bottom: 14px;
147
+ }
148
+
149
+ .article-block-wrapper__text {
150
+ padding-bottom: 14px;
151
+ }
152
+
153
+ .article-block-wrapper__title {
154
+ padding: 24px 0px 18px 0px;
155
+ }
156
+ }
@@ -0,0 +1 @@
1
+ <svg data-v-b1dad229="" data-v-e8bb27d2="" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="simple" style="height: 20px; width: 20px; fill: rgb(108, 120, 244); --9c44d20e: inherit;"><g opacity="0.39"><path d="M10.95 12C10.95 10.95 10.05 10.05 9.00003 10.05C7.95003 10.05 7.05005 10.95 7.05005 12C7.05005 13.05 7.95003 13.95 9.00003 13.95C10.05 13.95 10.95 13.05 10.95 12Z" fill="#6C78F4"></path><path d="M16.95 12C16.95 10.95 16.05 10.05 15 10.05C13.95 10.05 13.05 10.95 13.05 12C13.05 13.05 13.95 13.95 15 13.95C16.05 13.95 16.95 13.05 16.95 12Z" fill="#6C78F4"></path></g><path d="M10.95 4.94998C10.95 5.99998 10.05 6.89996 9.00003 6.89996C7.95003 6.89996 7.05005 5.99998 7.05005 4.94998C7.05005 3.89998 7.95003 3 9.00003 3C10.05 3 10.95 3.89998 10.95 4.94998ZM10.95 19.05C10.95 20.1 10.05 21 9.00003 21C7.95003 21 7.05005 20.1 7.05005 19.05C7.05005 18 7.95003 17.1 9.00003 17.1C10.05 17.1 10.95 17.85 10.95 19.05Z" fill="#6C78F4"></path><path d="M16.95 4.94998C16.95 5.99998 16.05 6.89996 15 6.89996C13.95 6.89996 13.05 5.99998 13.05 4.94998C13.05 3.89998 13.95 3 15 3C16.05 3 16.95 3.89998 16.95 4.94998ZM16.95 19.05C16.95 20.1 16.05 21 15 21C13.95 21 13.05 20.1 13.05 19.05C13.05 18 13.95 17.1 15 17.1C16.05 17.1 16.95 17.85 16.95 19.05Z" fill="#6C78F4"></path></svg>
@@ -0,0 +1,157 @@
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.TitleText = void 0;
9
+ var _react = _interopRequireWildcard(require("react"));
10
+ var _EditWrapper = require("../EditWrapper/EditWrapper");
11
+ var _Editor = require("../Editor/Editor");
12
+ var _htmlReactParser = _interopRequireDefault(require("html-react-parser"));
13
+ var _useDebounce = require("../../../common/hooks/useDebounce");
14
+ require("./TitleText.scss");
15
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
16
+ 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); }
17
+ 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; }
18
+ 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; }
19
+ 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; }
20
+ 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; }
21
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
22
+ 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); }
23
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
24
+ 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."); }
25
+ 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; } }
26
+ 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; }
27
+ 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; } }
28
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; } // import { ModalReplaceLink } from '../../Modal/ModalReplaceLink/ModalReplaceLink'
29
+ // import { TextAlignment } from '../TextAlignment/TextAlignment'
30
+ // import { TextSize } from '../TextSize/TextSize'
31
+ // import { ARTICLE_TYPES } from '../ArticleElement'
32
+ var TitleText = exports.TitleText = function TitleText(_ref) {
33
+ var _data$;
34
+ var id = _ref.id,
35
+ data = _ref.data,
36
+ editMode = _ref.editMode,
37
+ align = _ref.align,
38
+ onChange = _ref.onChange,
39
+ fontSize = _ref.fontSize,
40
+ onAddNewBlockClick = _ref.onAddNewBlockClick,
41
+ addNewBlock = _ref.addNewBlock,
42
+ position = _ref.position,
43
+ setIsChangeTypeModal = _ref.setIsChangeTypeModal,
44
+ changeContent = _ref.changeContent,
45
+ deleteContent = _ref.deleteContent,
46
+ setIsModal = _ref.setIsModal,
47
+ ind = _ref.ind,
48
+ setCurrentIndex = _ref.setCurrentIndex,
49
+ before = _ref.before,
50
+ setBeforeBlock = _ref.setBeforeBlock,
51
+ setContentArr = _ref.setContentArr,
52
+ deleteBlock = _ref.deleteBlock,
53
+ _ref$readonly = _ref.readonly,
54
+ readonly = _ref$readonly === void 0 ? false : _ref$readonly,
55
+ draggableElement = _ref.draggableElement,
56
+ setDraggableElement = _ref.setDraggableElement,
57
+ articleId = _ref.articleId,
58
+ fetchDataById = _ref.fetchDataById,
59
+ changeBlock = _ref.changeBlock;
60
+ var _useState = (0, _react.useState)((_data$ = data[0]) === null || _data$ === void 0 ? void 0 : _data$.value),
61
+ _useState2 = _slicedToArray(_useState, 2),
62
+ content = _useState2[0],
63
+ setContent = _useState2[1];
64
+ var ref = (0, _react.useRef)();
65
+ var debounceChange = (0, _useDebounce.useDebounce)(changeContent, 1000);
66
+ var handleDeleteBlock = function handleDeleteBlock(e) {
67
+ // setContent(e.currentTarget.textContent)
68
+ setContentArr(function (prev) {
69
+ return prev.filter(function (el) {
70
+ if ((el === null || el === void 0 ? void 0 : el.block_id) != id) {
71
+ return el;
72
+ }
73
+ });
74
+ });
75
+ deleteBlock(id);
76
+ };
77
+ var handleInput = function handleInput(e) {
78
+ var _ref$current;
79
+ debounceChange(id, [{
80
+ value: ref === null || ref === void 0 || (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.innerHTML,
81
+ properties: {}
82
+ }]);
83
+ setContentArr(function (prev) {
84
+ return prev.map(function (el) {
85
+ if ((el === null || el === void 0 ? void 0 : el.block_id) == id) {
86
+ var _ref$current2;
87
+ return _objectSpread(_objectSpread({}, el), {}, {
88
+ content: [{
89
+ value: ref === null || ref === void 0 || (_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.innerHTML
90
+ }]
91
+ });
92
+ } else {
93
+ return el;
94
+ }
95
+ });
96
+ });
97
+ };
98
+
99
+ // Вставка кода без форматирования
100
+ var handlePaste = function handlePaste(event) {
101
+ event.preventDefault(); // Отменяем стандартное поведение вставки
102
+ var text = event.clipboardData.getData('text/plain'); // Получаем только текст
103
+ document.execCommand('insertText', false, text); // Вставляем текст без форматирования
104
+ };
105
+ return /*#__PURE__*/_react["default"].createElement(_EditWrapper.EditWrapper, {
106
+ id: id,
107
+ before: before,
108
+ articleId: articleId,
109
+ changeBlock: changeBlock,
110
+ readonly: readonly,
111
+ draggableElement: draggableElement,
112
+ setDraggableElement: setDraggableElement,
113
+ fetchDataById: fetchDataById,
114
+ deleteFunc: function deleteFunc(e) {
115
+ return handleDeleteBlock(id);
116
+ },
117
+ type: "title",
118
+ child: /*#__PURE__*/_react["default"].createElement("div", {
119
+ style: {
120
+ display: 'flex',
121
+ flexDirection: 'column',
122
+ gap: '4px'
123
+ }
124
+ }, !readonly && /*#__PURE__*/_react["default"].createElement(_Editor.Editor, {
125
+ handleInput: handleInput
126
+ }), /*#__PURE__*/_react["default"].createElement("h2", {
127
+ id: id,
128
+ maxLength: 20,
129
+ suppressContentEditableWarning: true,
130
+ ref: ref,
131
+ className: "article__title",
132
+ contentEditable: !readonly,
133
+ dangerouslySetInnerHTML: {
134
+ __html: content
135
+ },
136
+ onInput: function onInput(e) {
137
+ return handleInput(e);
138
+ },
139
+ onPaste: handlePaste,
140
+ onContextMenu: function onContextMenu(e) {
141
+ if (!readonly) {
142
+ e.preventDefault();
143
+ setCurrentIndex(ind);
144
+ setIsModal(true);
145
+ }
146
+ },
147
+ onKeyDown: function onKeyDown(e) {
148
+ if (e.key === 'Enter') {}
149
+ if (e.key === '/') {}
150
+ },
151
+ onClick: function onClick(e) {
152
+ setCurrentIndex(ind);
153
+ setBeforeBlock(before);
154
+ }
155
+ }))
156
+ });
157
+ };
@@ -0,0 +1,74 @@
1
+ // @import url('../../../font.scss');
2
+
3
+ .article__title {
4
+ display: inline-block;
5
+ width: 100%;
6
+ text-align: left;
7
+ color: #191919;
8
+ font-family: "Open Sans";
9
+ font-size: 36px;
10
+ font-style: normal;
11
+ font-weight: 500;
12
+ line-height: 1.6;
13
+ word-break: break-word;
14
+ padding: 0;
15
+
16
+ p,
17
+ span, li {
18
+ color: inherit !important;
19
+ font-family: inherit !important;
20
+ font-size: inherit !important;
21
+ font-style: inherit !important;
22
+ font-weight: inherit !important;
23
+ line-height: inherit !important;
24
+ }
25
+
26
+ a {
27
+ color: #1890ff;
28
+ text-decoration: underline;
29
+ }
30
+
31
+ &:empty {
32
+ min-height: 58px;
33
+ width: 100%;
34
+ padding-bottom: 18px;
35
+
36
+ &::after {
37
+ content: "Введите заголовок";
38
+ color: #D9D9D9;
39
+ }
40
+ }
41
+ }
42
+
43
+ .title__medium[contenteditable="true"] {
44
+ outline: none;
45
+ // margin: 10px 20px;
46
+ }
47
+
48
+ .article__title[contenteditable="true"] {
49
+ outline: none;
50
+
51
+ &:empty {
52
+ width: 100%;
53
+ // border: 1px solid red;
54
+
55
+ &::after {
56
+ content: "Введите заголовок";
57
+ color: #D9D9D9;
58
+ }
59
+ }
60
+ }
61
+
62
+ @media (max-width: 1100px) {
63
+ .article__title {
64
+ font-size: 28px !important;
65
+
66
+ }
67
+ }
68
+
69
+ @media (max-width: 430px) {
70
+ .article__title {
71
+ font-size: 24px !important;
72
+
73
+ }
74
+ }