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,775 @@
|
|
|
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["default"] = exports.STATUSES = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _fetchUrls = require("../../../common/fetchUrls");
|
|
11
|
+
var _utils = require("../../../common/utils");
|
|
12
|
+
var _ArticleViewV = _interopRequireDefault(require("../ArticleViewV2/ArticleViewV2"));
|
|
13
|
+
var _ListOfContent = _interopRequireDefault(require("../ListOfContent/ListOfContent"));
|
|
14
|
+
var _TableBox = _interopRequireDefault(require("../../Table/TableBox/TableBox"));
|
|
15
|
+
var _useDebounce = require("../../../common/hooks/useDebounce");
|
|
16
|
+
var _headers = _interopRequireDefault(require("../../../common/headers"));
|
|
17
|
+
require("./ArticleWiki.scss");
|
|
18
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
19
|
+
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); }
|
|
20
|
+
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; }
|
|
21
|
+
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; }
|
|
22
|
+
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; }
|
|
23
|
+
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; }
|
|
24
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
25
|
+
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); }
|
|
26
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
27
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
28
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
29
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
30
|
+
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."); }
|
|
31
|
+
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; } }
|
|
32
|
+
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; }
|
|
33
|
+
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; } }
|
|
34
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; } // import ModalError from '../../components/Modal/ModalError/ModalError'
|
|
35
|
+
// import { useParams, useNavigate } from 'react-router-dom'
|
|
36
|
+
// import { TitleContentEditable } from '@lk-gtcom/ecomlab-components'
|
|
37
|
+
var BASE_ROUTE = '';
|
|
38
|
+
var STATUSES = exports.STATUSES = {
|
|
39
|
+
active: 'active',
|
|
40
|
+
update: 'update',
|
|
41
|
+
redact: 'redact'
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// 30 минут
|
|
45
|
+
var TIME_TO_INACTIVE_MS = 1000 * 60 * 30;
|
|
46
|
+
var ArticleWiki = function ArticleWiki(_ref) {
|
|
47
|
+
var _portalLevels$find;
|
|
48
|
+
var activeLang = _ref.activeLang,
|
|
49
|
+
isNew = _ref.isNew,
|
|
50
|
+
pathBread = _ref.pathBread,
|
|
51
|
+
setCurrentArticle = _ref.setCurrentArticle,
|
|
52
|
+
setTags = _ref.setTags,
|
|
53
|
+
tags = _ref.tags,
|
|
54
|
+
setPaths = _ref.setPaths,
|
|
55
|
+
setPathsWebName = _ref.setPathsWebName,
|
|
56
|
+
setTitle = _ref.setTitle,
|
|
57
|
+
setDescription = _ref.setDescription,
|
|
58
|
+
parent_id = _ref.parent_id,
|
|
59
|
+
portal_id = _ref.portal_id,
|
|
60
|
+
pageValue = _ref.pageValue,
|
|
61
|
+
setStatusText = _ref.setStatusText,
|
|
62
|
+
fetchGetBreadcrumbs = _ref.fetchGetBreadcrumbs,
|
|
63
|
+
setSelectedItemId = _ref.setSelectedItemId;
|
|
64
|
+
var _useState = (0, _react.useState)(-1),
|
|
65
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
66
|
+
articleId = _useState2[0],
|
|
67
|
+
setArticleId = _useState2[1];
|
|
68
|
+
var _useState3 = (0, _react.useState)({}),
|
|
69
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
70
|
+
apiData = _useState4[0],
|
|
71
|
+
setApiData = _useState4[1];
|
|
72
|
+
var _useState5 = (0, _react.useState)([]),
|
|
73
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
74
|
+
portals = _useState6[0],
|
|
75
|
+
setPortals = _useState6[1];
|
|
76
|
+
var _useState7 = (0, _react.useState)([]),
|
|
77
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
78
|
+
portalLevels = _useState8[0],
|
|
79
|
+
setPortalLevels = _useState8[1];
|
|
80
|
+
var _useState9 = (0, _react.useState)([]),
|
|
81
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
82
|
+
allTags = _useState10[0],
|
|
83
|
+
setAllTags = _useState10[1];
|
|
84
|
+
var _useState11 = (0, _react.useState)(false),
|
|
85
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
86
|
+
loading = _useState12[0],
|
|
87
|
+
setLoading = _useState12[1];
|
|
88
|
+
var portalId = "articles-portal";
|
|
89
|
+
var _useState13 = (0, _react.useState)(false),
|
|
90
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
91
|
+
showErrorModal = _useState14[0],
|
|
92
|
+
setShowErrorModal = _useState14[1];
|
|
93
|
+
var _useState15 = (0, _react.useState)(""),
|
|
94
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
95
|
+
errorHeader = _useState16[0],
|
|
96
|
+
setErrorHeader = _useState16[1];
|
|
97
|
+
var _useState17 = (0, _react.useState)(""),
|
|
98
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
99
|
+
errorMessage = _useState18[0],
|
|
100
|
+
setErrorMessage = _useState18[1];
|
|
101
|
+
var _useState19 = (0, _react.useState)(false),
|
|
102
|
+
_useState20 = _slicedToArray(_useState19, 2),
|
|
103
|
+
publishInProgress = _useState20[0],
|
|
104
|
+
setPublishInProgress = _useState20[1];
|
|
105
|
+
var _useState21 = (0, _react.useState)(false),
|
|
106
|
+
_useState22 = _slicedToArray(_useState21, 2),
|
|
107
|
+
tagCreationInProgress = _useState22[0],
|
|
108
|
+
setTagCreationInProgress = _useState22[1];
|
|
109
|
+
var _useState23 = (0, _react.useState)(false),
|
|
110
|
+
_useState24 = _slicedToArray(_useState23, 2),
|
|
111
|
+
contentChanged = _useState24[0],
|
|
112
|
+
_setContentChanged = _useState24[1];
|
|
113
|
+
var publishButtonRef = (0, _react.useRef)(null);
|
|
114
|
+
var _useState25 = (0, _react.useState)([]),
|
|
115
|
+
_useState26 = _slicedToArray(_useState25, 2),
|
|
116
|
+
contentLinks = _useState26[0],
|
|
117
|
+
setContentLinks = _useState26[1];
|
|
118
|
+
var _useState27 = (0, _react.useState)([]),
|
|
119
|
+
_useState28 = _slicedToArray(_useState27, 2),
|
|
120
|
+
listLinks = _useState28[0],
|
|
121
|
+
setListLinks = _useState28[1];
|
|
122
|
+
var dataHasBeenFetched = Object.keys(apiData).length !== 0;
|
|
123
|
+
|
|
124
|
+
// metadata
|
|
125
|
+
var _useState29 = (0, _react.useState)(""),
|
|
126
|
+
_useState30 = _slicedToArray(_useState29, 2),
|
|
127
|
+
author = _useState30[0],
|
|
128
|
+
setAuthor = _useState30[1];
|
|
129
|
+
var _useState31 = (0, _react.useState)(""),
|
|
130
|
+
_useState32 = _slicedToArray(_useState31, 2),
|
|
131
|
+
articleTitle = _useState32[0],
|
|
132
|
+
_setArticleTitle = _useState32[1];
|
|
133
|
+
var articleTitleRef = (0, _react.useRef)();
|
|
134
|
+
var _useState33 = (0, _react.useState)(new Date()),
|
|
135
|
+
_useState34 = _slicedToArray(_useState33, 2),
|
|
136
|
+
publicationDate = _useState34[0],
|
|
137
|
+
setPublicationDate = _useState34[1];
|
|
138
|
+
var _useState35 = (0, _react.useState)(0),
|
|
139
|
+
_useState36 = _slicedToArray(_useState35, 2),
|
|
140
|
+
readingTime = _useState36[0],
|
|
141
|
+
setReadingTime = _useState36[1];
|
|
142
|
+
var _useState37 = (0, _react.useState)(0),
|
|
143
|
+
_useState38 = _slicedToArray(_useState37, 2),
|
|
144
|
+
views = _useState38[0],
|
|
145
|
+
setViews = _useState38[1];
|
|
146
|
+
var _useState39 = (0, _react.useState)(false),
|
|
147
|
+
_useState40 = _slicedToArray(_useState39, 2),
|
|
148
|
+
readonly = _useState40[0],
|
|
149
|
+
setReadonly = _useState40[1];
|
|
150
|
+
var _useState41 = (0, _react.useState)(""),
|
|
151
|
+
_useState42 = _slicedToArray(_useState41, 2),
|
|
152
|
+
initialStatus = _useState42[0],
|
|
153
|
+
setInitialStatus = _useState42[1];
|
|
154
|
+
// const [statusText, setStatusText] = useState("")
|
|
155
|
+
var _useState43 = (0, _react.useState)({}),
|
|
156
|
+
_useState44 = _slicedToArray(_useState43, 2),
|
|
157
|
+
breadcrumbs = _useState44[0],
|
|
158
|
+
setBreadcrumbs = _useState44[1];
|
|
159
|
+
var _useState45 = (0, _react.useState)(''),
|
|
160
|
+
_useState46 = _slicedToArray(_useState45, 2),
|
|
161
|
+
seoTitle = _useState46[0],
|
|
162
|
+
setSeoTitle = _useState46[1];
|
|
163
|
+
var _useState47 = (0, _react.useState)(''),
|
|
164
|
+
_useState48 = _slicedToArray(_useState47, 2),
|
|
165
|
+
seoDescription = _useState48[0],
|
|
166
|
+
setSeoDescription = _useState48[1];
|
|
167
|
+
var _useState49 = (0, _react.useState)([]),
|
|
168
|
+
_useState50 = _slicedToArray(_useState49, 2),
|
|
169
|
+
tableData = _useState50[0],
|
|
170
|
+
setTableData = _useState50[1];
|
|
171
|
+
var _useState51 = (0, _react.useState)([]),
|
|
172
|
+
_useState52 = _slicedToArray(_useState51, 2),
|
|
173
|
+
tableHeaders = _useState52[0],
|
|
174
|
+
setTableHeaders = _useState52[1];
|
|
175
|
+
var _useState53 = (0, _react.useState)([]),
|
|
176
|
+
_useState54 = _slicedToArray(_useState53, 2),
|
|
177
|
+
columnSize = _useState54[0],
|
|
178
|
+
setColumnSize = _useState54[1];
|
|
179
|
+
var _useState55 = (0, _react.useState)(false),
|
|
180
|
+
_useState56 = _slicedToArray(_useState55, 2),
|
|
181
|
+
tableLoading = _useState56[0],
|
|
182
|
+
setTableLoading = _useState56[1];
|
|
183
|
+
var _useState57 = (0, _react.useState)([]),
|
|
184
|
+
_useState58 = _slicedToArray(_useState57, 2),
|
|
185
|
+
selectedPortal = _useState58[0],
|
|
186
|
+
setSelectedPortal = _useState58[1];
|
|
187
|
+
var _useState59 = (0, _react.useState)({}),
|
|
188
|
+
_useState60 = _slicedToArray(_useState59, 2),
|
|
189
|
+
selectedTopLevel = _useState60[0],
|
|
190
|
+
setSelectedTopLevel = _useState60[1];
|
|
191
|
+
var availableSecondLevels = (_portalLevels$find = portalLevels.find(function (l) {
|
|
192
|
+
return l.value === selectedTopLevel.value;
|
|
193
|
+
})) === null || _portalLevels$find === void 0 ? void 0 : _portalLevels$find.subItems;
|
|
194
|
+
var portalLevelsSelectRef = (0, _react.useRef)();
|
|
195
|
+
var secondLevelSelectRef = (0, _react.useRef)();
|
|
196
|
+
var _useState61 = (0, _react.useState)(true),
|
|
197
|
+
_useState62 = _slicedToArray(_useState61, 2),
|
|
198
|
+
userActive = _useState62[0],
|
|
199
|
+
setUserActive = _useState62[1];
|
|
200
|
+
var inactivityTimeoutRef = (0, _react.useRef)();
|
|
201
|
+
var _useState63 = (0, _react.useState)([]),
|
|
202
|
+
_useState64 = _slicedToArray(_useState63, 2),
|
|
203
|
+
contentData = _useState64[0],
|
|
204
|
+
setContentData = _useState64[1];
|
|
205
|
+
var setContentDataCallback = (0, _react.useCallback)(function (e) {
|
|
206
|
+
return setContentData(e);
|
|
207
|
+
}, []);
|
|
208
|
+
var fetchSeoTitle = function fetchSeoTitle(value) {
|
|
209
|
+
var url = "".concat(_fetchUrls.RavshanHttps, "/api/v2/article/set_title");
|
|
210
|
+
var body = JSON.stringify({
|
|
211
|
+
article_id: articleId,
|
|
212
|
+
title: value
|
|
213
|
+
});
|
|
214
|
+
fetch(url, {
|
|
215
|
+
body: body,
|
|
216
|
+
method: 'POST',
|
|
217
|
+
headers: _headers["default"]
|
|
218
|
+
}).then(/*#__PURE__*/function () {
|
|
219
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(res) {
|
|
220
|
+
var err;
|
|
221
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
222
|
+
while (1) switch (_context.prev = _context.next) {
|
|
223
|
+
case 0:
|
|
224
|
+
if (!res.ok) {
|
|
225
|
+
_context.next = 4;
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
228
|
+
return _context.abrupt("return", res.json());
|
|
229
|
+
case 4:
|
|
230
|
+
_context.next = 6;
|
|
231
|
+
return res.json();
|
|
232
|
+
case 6:
|
|
233
|
+
err = _context.sent;
|
|
234
|
+
throw new Error(JSON.stringify(err));
|
|
235
|
+
case 8:
|
|
236
|
+
case "end":
|
|
237
|
+
return _context.stop();
|
|
238
|
+
}
|
|
239
|
+
}, _callee);
|
|
240
|
+
}));
|
|
241
|
+
return function (_x) {
|
|
242
|
+
return _ref2.apply(this, arguments);
|
|
243
|
+
};
|
|
244
|
+
}()).then(function (json) {})["catch"](function (err) {
|
|
245
|
+
console.error(err);
|
|
246
|
+
});
|
|
247
|
+
};
|
|
248
|
+
var fetchSeoDesctiption = function fetchSeoDesctiption(value) {
|
|
249
|
+
var url = "".concat(_fetchUrls.RavshanHttps, "/api/v2/article/set_description");
|
|
250
|
+
var body = JSON.stringify({
|
|
251
|
+
article_id: articleId,
|
|
252
|
+
description: value
|
|
253
|
+
});
|
|
254
|
+
fetch(url, {
|
|
255
|
+
body: body,
|
|
256
|
+
method: 'POST',
|
|
257
|
+
headers: _headers["default"]
|
|
258
|
+
}).then(/*#__PURE__*/function () {
|
|
259
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(res) {
|
|
260
|
+
var err;
|
|
261
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
262
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
263
|
+
case 0:
|
|
264
|
+
if (!res.ok) {
|
|
265
|
+
_context2.next = 4;
|
|
266
|
+
break;
|
|
267
|
+
}
|
|
268
|
+
return _context2.abrupt("return", res.json());
|
|
269
|
+
case 4:
|
|
270
|
+
_context2.next = 6;
|
|
271
|
+
return res.json();
|
|
272
|
+
case 6:
|
|
273
|
+
err = _context2.sent;
|
|
274
|
+
throw new Error(JSON.stringify(err));
|
|
275
|
+
case 8:
|
|
276
|
+
case "end":
|
|
277
|
+
return _context2.stop();
|
|
278
|
+
}
|
|
279
|
+
}, _callee2);
|
|
280
|
+
}));
|
|
281
|
+
return function (_x2) {
|
|
282
|
+
return _ref3.apply(this, arguments);
|
|
283
|
+
};
|
|
284
|
+
}()).then(function (json) {})["catch"](function (err) {
|
|
285
|
+
console.error(err);
|
|
286
|
+
});
|
|
287
|
+
};
|
|
288
|
+
var debounceSeoDesctiption = (0, _useDebounce.useDebounce)(fetchSeoDesctiption, 1000);
|
|
289
|
+
var debounceSeoTitle = (0, _useDebounce.useDebounce)(fetchSeoTitle, 1000);
|
|
290
|
+
var setArrayResponseToFilterData = function setArrayResponseToFilterData(data, set) {
|
|
291
|
+
var _data$label, _data$label2, _data$data;
|
|
292
|
+
var idIndex = (_data$label = data.label) === null || _data$label === void 0 ? void 0 : _data$label.header.findIndex(function (h) {
|
|
293
|
+
return h === "id";
|
|
294
|
+
});
|
|
295
|
+
var nameIndex = (_data$label2 = data.label) === null || _data$label2 === void 0 ? void 0 : _data$label2.header.findIndex(function (h) {
|
|
296
|
+
return h === "name";
|
|
297
|
+
});
|
|
298
|
+
set((_data$data = data.data) === null || _data$data === void 0 ? void 0 : _data$data.map(function (el) {
|
|
299
|
+
return {
|
|
300
|
+
label: el[nameIndex],
|
|
301
|
+
value: el[idIndex]
|
|
302
|
+
};
|
|
303
|
+
}));
|
|
304
|
+
};
|
|
305
|
+
var onAddTagClick = function onAddTagClick(tag) {
|
|
306
|
+
setTagCreationInProgress(true);
|
|
307
|
+
var body = JSON.stringify({
|
|
308
|
+
tag_name: tag
|
|
309
|
+
});
|
|
310
|
+
fetch("".concat(_fetchUrls.RavshanArticlesHttps, "/post_tag"), {
|
|
311
|
+
body: body,
|
|
312
|
+
method: 'POST',
|
|
313
|
+
headers: _headers["default"]
|
|
314
|
+
}).then(function (res) {
|
|
315
|
+
return (0, _utils.handleApiResponseOrThrow)(res);
|
|
316
|
+
}).then(function (id) {
|
|
317
|
+
fetchAllTags();
|
|
318
|
+
setTags(function (prev) {
|
|
319
|
+
prev.push({
|
|
320
|
+
label: tag,
|
|
321
|
+
value: id
|
|
322
|
+
});
|
|
323
|
+
return prev;
|
|
324
|
+
});
|
|
325
|
+
})["catch"](function (error) {
|
|
326
|
+
return console.error(error);
|
|
327
|
+
})["finally"](function () {
|
|
328
|
+
setTagCreationInProgress(false);
|
|
329
|
+
});
|
|
330
|
+
};
|
|
331
|
+
var fetchPortalLevels = function fetchPortalLevels() {
|
|
332
|
+
if (!(selectedPortal !== null && selectedPortal !== void 0 && selectedPortal.value)) return;
|
|
333
|
+
var getHeaders = _objectSpread(_objectSpread({}, _headers["default"]), {}, {
|
|
334
|
+
"portal-id": selectedPortal.value,
|
|
335
|
+
"language": activeLang === null || activeLang === void 0 ? void 0 : activeLang.toLowerCase()
|
|
336
|
+
});
|
|
337
|
+
fetch("".concat(_fetchUrls.RavshanArticlesHttps, "/get_portals_levels"), {
|
|
338
|
+
headers: getHeaders
|
|
339
|
+
}).then(function (response) {
|
|
340
|
+
return (0, _utils.handleApiResponseOrThrow)(response);
|
|
341
|
+
}).then(function (json) {
|
|
342
|
+
return setPortalLevels(json);
|
|
343
|
+
})["catch"](function (error) {
|
|
344
|
+
return console.error(error);
|
|
345
|
+
});
|
|
346
|
+
};
|
|
347
|
+
var fetchTableData = function fetchTableData(params) {
|
|
348
|
+
setTableLoading(true);
|
|
349
|
+
var url;
|
|
350
|
+
if (!window.location.hostname.match('localhost')) {
|
|
351
|
+
url = "".concat(_fetchUrls.RavshanArticlesHttps, "/get_seo_analysis");
|
|
352
|
+
} else {
|
|
353
|
+
url = "".concat(_fetchUrls.RavshanArticlesHttps, "/get_seo_analysis");
|
|
354
|
+
}
|
|
355
|
+
var body = JSON.stringify({
|
|
356
|
+
article_id: articleId,
|
|
357
|
+
metric: "common"
|
|
358
|
+
});
|
|
359
|
+
fetch(url, {
|
|
360
|
+
body: body,
|
|
361
|
+
method: 'POST',
|
|
362
|
+
headers: _headers["default"]
|
|
363
|
+
}).then(function (res) {
|
|
364
|
+
return res.json();
|
|
365
|
+
}).then(function (json) {
|
|
366
|
+
var data = json.data,
|
|
367
|
+
labels = json.labels,
|
|
368
|
+
total = json.total,
|
|
369
|
+
sort = json.sort,
|
|
370
|
+
column_size = json.column_size;
|
|
371
|
+
// if (total) paginatorRef.current?.setTotal(total)
|
|
372
|
+
if (data) setTableData(data);
|
|
373
|
+
if (labels) setTableHeaders(labels);
|
|
374
|
+
if (column_size) setColumnSize(column_size);
|
|
375
|
+
// if (sort) setSort(sort)
|
|
376
|
+
})["catch"](function (err) {
|
|
377
|
+
console.error(err);
|
|
378
|
+
})["finally"](function () {
|
|
379
|
+
return setTableLoading(false);
|
|
380
|
+
});
|
|
381
|
+
};
|
|
382
|
+
var fetchDataById = function fetchDataById(id) {
|
|
383
|
+
setLoading(true);
|
|
384
|
+
var url = "".concat(_fetchUrls.RavshanArticlesHttps, "/api/v2/article/get_article/").concat(id ? id : articleId);
|
|
385
|
+
fetch(url, {
|
|
386
|
+
headers: _headers["default"]
|
|
387
|
+
}).then(/*#__PURE__*/function () {
|
|
388
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(res) {
|
|
389
|
+
var err;
|
|
390
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
391
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
392
|
+
case 0:
|
|
393
|
+
if (!res.ok) {
|
|
394
|
+
_context3.next = 4;
|
|
395
|
+
break;
|
|
396
|
+
}
|
|
397
|
+
return _context3.abrupt("return", res.json());
|
|
398
|
+
case 4:
|
|
399
|
+
_context3.next = 6;
|
|
400
|
+
return res.json();
|
|
401
|
+
case 6:
|
|
402
|
+
err = _context3.sent;
|
|
403
|
+
throw new Error(JSON.stringify(err));
|
|
404
|
+
case 8:
|
|
405
|
+
case "end":
|
|
406
|
+
return _context3.stop();
|
|
407
|
+
}
|
|
408
|
+
}, _callee3);
|
|
409
|
+
}));
|
|
410
|
+
return function (_x3) {
|
|
411
|
+
return _ref4.apply(this, arguments);
|
|
412
|
+
};
|
|
413
|
+
}()).then(function (json) {
|
|
414
|
+
if (Object.keys(json).length === 0) {
|
|
415
|
+
// navigate(`/wiki/${pathBread}/${BASE_ROUTE}`)
|
|
416
|
+
}
|
|
417
|
+
setApiData(json);
|
|
418
|
+
setCurrentArticle({
|
|
419
|
+
title: json.name,
|
|
420
|
+
breadcrumbs: json.breadCrumbs
|
|
421
|
+
});
|
|
422
|
+
setBreadcrumbs(json.breadCrumbs);
|
|
423
|
+
})["catch"](function (error) {
|
|
424
|
+
return console.error(error);
|
|
425
|
+
})["finally"](function () {
|
|
426
|
+
return setLoading(false);
|
|
427
|
+
});
|
|
428
|
+
};
|
|
429
|
+
var sendStatus = function sendStatus(status) {
|
|
430
|
+
var url = "".concat(_fetchUrls.RavshanArticlesHttps, "/post_status");
|
|
431
|
+
var body = JSON.stringify({
|
|
432
|
+
id: articleId,
|
|
433
|
+
status: status
|
|
434
|
+
});
|
|
435
|
+
// не ждём ответ чтобы не блокировать поток
|
|
436
|
+
fetch(url, {
|
|
437
|
+
headers: _headers["default"],
|
|
438
|
+
method: 'POST',
|
|
439
|
+
body: body,
|
|
440
|
+
keepalive: true
|
|
441
|
+
});
|
|
442
|
+
if (status === STATUSES.redact) setStatusText('Статья редактируется');
|
|
443
|
+
if (status === STATUSES.active) setStatusText('');
|
|
444
|
+
};
|
|
445
|
+
var handleStatus = function handleStatus(status) {
|
|
446
|
+
setInitialStatus(status);
|
|
447
|
+
if (status === STATUSES.active) return;
|
|
448
|
+
if (status === STATUSES.redact) {
|
|
449
|
+
setStatusText('Статья редактируется');
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
if (status === STATUSES.update) {
|
|
453
|
+
setStatusText('Статья обновляется');
|
|
454
|
+
setReadonly(true);
|
|
455
|
+
}
|
|
456
|
+
};
|
|
457
|
+
|
|
458
|
+
// const mapContentToApiRequest = content => {
|
|
459
|
+
|
|
460
|
+
(0, _react.useEffect)(function () {
|
|
461
|
+
var onUnload = function onUnload() {
|
|
462
|
+
return sendStatus(STATUSES.active);
|
|
463
|
+
};
|
|
464
|
+
var goInactive = function goInactive() {
|
|
465
|
+
sendStatus(STATUSES.active);
|
|
466
|
+
setUserActive(false);
|
|
467
|
+
};
|
|
468
|
+
var startTimer = function startTimer() {
|
|
469
|
+
inactivityTimeoutRef.current = setTimeout(goInactive, TIME_TO_INACTIVE_MS);
|
|
470
|
+
};
|
|
471
|
+
var resetTimer = function resetTimer() {
|
|
472
|
+
clearTimeout(inactivityTimeoutRef.current);
|
|
473
|
+
setUserActive(true);
|
|
474
|
+
startTimer();
|
|
475
|
+
};
|
|
476
|
+
|
|
477
|
+
// для отправки статуса по закрытию вкладки
|
|
478
|
+
window.addEventListener('beforeunload', onUnload);
|
|
479
|
+
|
|
480
|
+
// взаимодействие со страницей
|
|
481
|
+
document.addEventListener("mousemove", resetTimer, false);
|
|
482
|
+
document.addEventListener("mousedown", resetTimer, false);
|
|
483
|
+
document.addEventListener("keypress", resetTimer, false);
|
|
484
|
+
document.addEventListener("DOMMouseScroll", resetTimer, false);
|
|
485
|
+
document.addEventListener("mousewheel", resetTimer, false);
|
|
486
|
+
document.addEventListener("touchmove", resetTimer, false);
|
|
487
|
+
document.addEventListener("MSPointerMove", resetTimer, false);
|
|
488
|
+
|
|
489
|
+
// если пользователь перешёл на другую вкладку
|
|
490
|
+
window.addEventListener("blur", startTimer, false);
|
|
491
|
+
window.addEventListener("focus", resetTimer, false);
|
|
492
|
+
startTimer();
|
|
493
|
+
return function () {
|
|
494
|
+
window.removeEventListener('beforeunload', onUnload);
|
|
495
|
+
document.removeEventListener("mousemove", resetTimer, false);
|
|
496
|
+
document.removeEventListener("mousedown", resetTimer, false);
|
|
497
|
+
document.removeEventListener("keypress", resetTimer, false);
|
|
498
|
+
document.removeEventListener("DOMMouseScroll", resetTimer, false);
|
|
499
|
+
document.removeEventListener("mousewheel", resetTimer, false);
|
|
500
|
+
document.removeEventListener("touchmove", resetTimer, false);
|
|
501
|
+
document.removeEventListener("MSPointerMove", resetTimer, false);
|
|
502
|
+
window.removeEventListener("blur", startTimer, false);
|
|
503
|
+
window.removeEventListener("focus", resetTimer, false);
|
|
504
|
+
};
|
|
505
|
+
}, []);
|
|
506
|
+
(0, _react.useEffect)(function () {
|
|
507
|
+
return function () {
|
|
508
|
+
setCurrentArticle({});
|
|
509
|
+
};
|
|
510
|
+
}, []);
|
|
511
|
+
(0, _react.useEffect)(function () {
|
|
512
|
+
if (pageValue === 'seo') {
|
|
513
|
+
fetchTableData();
|
|
514
|
+
}
|
|
515
|
+
}, [pageValue]);
|
|
516
|
+
(0, _react.useEffect)(function () {
|
|
517
|
+
if (contentChanged && userActive && dataHasBeenFetched && !isNew) sendStatus(STATUSES.redact);
|
|
518
|
+
}, [userActive, contentChanged]);
|
|
519
|
+
(0, _react.useEffect)(function () {
|
|
520
|
+
return function () {
|
|
521
|
+
// сбросить статус может только тот, кто изначально перевёл его из active в redact
|
|
522
|
+
if (initialStatus === STATUSES.active) sendStatus(STATUSES.active);
|
|
523
|
+
};
|
|
524
|
+
}, [initialStatus]);
|
|
525
|
+
(0, _react.useLayoutEffect)(function () {
|
|
526
|
+
if (articleTitleRef.current) {
|
|
527
|
+
var maxNumberOfCharacters = 29;
|
|
528
|
+
var add = Math.floor(articleTitle.length / maxNumberOfCharacters);
|
|
529
|
+
var numberOfLineBreaks = (articleTitle.match(/\n/g) || []).length + add;
|
|
530
|
+
// min-height + lines x line-height + padding
|
|
531
|
+
var newHeight = 1 + numberOfLineBreaks * 1 + 0.5;
|
|
532
|
+
articleTitleRef.current.style.height = newHeight + 'em';
|
|
533
|
+
}
|
|
534
|
+
}, [articleTitle]);
|
|
535
|
+
(0, _react.useEffect)(function () {
|
|
536
|
+
if (portalLevelsSelectRef.current) {
|
|
537
|
+
portalLevelsSelectRef.current.clearValue();
|
|
538
|
+
}
|
|
539
|
+
fetchPortalLevels();
|
|
540
|
+
}, [selectedPortal]);
|
|
541
|
+
(0, _react.useEffect)(function () {
|
|
542
|
+
if (secondLevelSelectRef.current) {
|
|
543
|
+
secondLevelSelectRef.current.clearValue();
|
|
544
|
+
}
|
|
545
|
+
}, [selectedTopLevel]);
|
|
546
|
+
|
|
547
|
+
// эффект для фетчинга контента статьи
|
|
548
|
+
// useEffect(() => {
|
|
549
|
+
// if (!isNew) {
|
|
550
|
+
// setArticleId(params['*'].split('/').at(-1))
|
|
551
|
+
// fetchDataById(params['*'].split('/').at(-1))
|
|
552
|
+
// } else {
|
|
553
|
+
// setCurrentArticle({})
|
|
554
|
+
// fetchAllPortals()
|
|
555
|
+
// createArticle()
|
|
556
|
+
// }
|
|
557
|
+
// fetchAllTags()
|
|
558
|
+
// }, [isNew])
|
|
559
|
+
|
|
560
|
+
(0, _react.useEffect)(function () {
|
|
561
|
+
if (!apiData) {
|
|
562
|
+
return;
|
|
563
|
+
}
|
|
564
|
+
var author = apiData.author,
|
|
565
|
+
date = apiData.date,
|
|
566
|
+
name = apiData.name,
|
|
567
|
+
reading_time_min = apiData.reading_time_min,
|
|
568
|
+
friendlyURL = apiData.friendlyURL,
|
|
569
|
+
tags = apiData.tags,
|
|
570
|
+
views = apiData.views,
|
|
571
|
+
status = apiData.status,
|
|
572
|
+
title = apiData.title,
|
|
573
|
+
description = apiData.description,
|
|
574
|
+
breadCrumbs = apiData.breadCrumbs,
|
|
575
|
+
language = apiData.language,
|
|
576
|
+
preview = apiData.preview;
|
|
577
|
+
if (author) setAuthor(author);
|
|
578
|
+
if (date) setPublicationDate(new Date(date));
|
|
579
|
+
if (name) _setArticleTitle(name);
|
|
580
|
+
if (reading_time_min) setReadingTime(reading_time_min);
|
|
581
|
+
if (tags) setTags(tags.map(function (t) {
|
|
582
|
+
return {
|
|
583
|
+
label: t.name,
|
|
584
|
+
value: t.id
|
|
585
|
+
};
|
|
586
|
+
}));
|
|
587
|
+
if (views) setViews(views);
|
|
588
|
+
// if (friendlyURL) navigate(preview[0]?.portal_id == 6 ? '/wiki/ru' + friendlyURL : '/wiki' + friendlyURL, { replace: true })
|
|
589
|
+
if (status) handleStatus(status);
|
|
590
|
+
if (title) {
|
|
591
|
+
setTitle(title);
|
|
592
|
+
setSeoTitle(title);
|
|
593
|
+
}
|
|
594
|
+
if (description) {
|
|
595
|
+
setDescription(description);
|
|
596
|
+
setSeoDescription(description);
|
|
597
|
+
}
|
|
598
|
+
if ((breadCrumbs === null || breadCrumbs === void 0 ? void 0 : breadCrumbs.length) > 0) {
|
|
599
|
+
setPaths(breadCrumbs === null || breadCrumbs === void 0 ? void 0 : breadCrumbs.map(function (el) {
|
|
600
|
+
return el === null || el === void 0 ? void 0 : el.label;
|
|
601
|
+
}));
|
|
602
|
+
setPathsWebName(breadCrumbs === null || breadCrumbs === void 0 ? void 0 : breadCrumbs.map(function (el) {
|
|
603
|
+
return el === null || el === void 0 ? void 0 : el.web_name;
|
|
604
|
+
}));
|
|
605
|
+
}
|
|
606
|
+
}, [apiData]);
|
|
607
|
+
(0, _react.useEffect)(function () {
|
|
608
|
+
if (isNew) {
|
|
609
|
+
setAuthor("");
|
|
610
|
+
setPublicationDate(new Date());
|
|
611
|
+
_setArticleTitle("");
|
|
612
|
+
setReadingTime(0);
|
|
613
|
+
setTags([]);
|
|
614
|
+
setViews(0);
|
|
615
|
+
setContentData([]);
|
|
616
|
+
setTitle('New article');
|
|
617
|
+
setDescription('Create new article');
|
|
618
|
+
}
|
|
619
|
+
}, [isNew]);
|
|
620
|
+
var deleteArticle = function deleteArticle(articleId) {
|
|
621
|
+
if (!articleTitle) {
|
|
622
|
+
var url;
|
|
623
|
+
if (!window.location.hostname.match('localhost')) {
|
|
624
|
+
url = "".concat(_fetchUrls.RavshanHttps, "/delete_article?article_id=").concat(articleId);
|
|
625
|
+
} else {
|
|
626
|
+
url = "".concat(_fetchUrls.RavshanHttps, "/delete_article?article_id=").concat(articleId);
|
|
627
|
+
}
|
|
628
|
+
fetch(url, {
|
|
629
|
+
method: 'DELETE',
|
|
630
|
+
headers: _headers["default"]
|
|
631
|
+
}).then(/*#__PURE__*/function () {
|
|
632
|
+
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(res) {
|
|
633
|
+
var err;
|
|
634
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
635
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
636
|
+
case 0:
|
|
637
|
+
if (!res.ok) {
|
|
638
|
+
_context4.next = 4;
|
|
639
|
+
break;
|
|
640
|
+
}
|
|
641
|
+
return _context4.abrupt("return", res.json());
|
|
642
|
+
case 4:
|
|
643
|
+
_context4.next = 6;
|
|
644
|
+
return res.json();
|
|
645
|
+
case 6:
|
|
646
|
+
err = _context4.sent;
|
|
647
|
+
throw Error(JSON.stringify(err));
|
|
648
|
+
case 8:
|
|
649
|
+
case "end":
|
|
650
|
+
return _context4.stop();
|
|
651
|
+
}
|
|
652
|
+
}, _callee4);
|
|
653
|
+
}));
|
|
654
|
+
return function (_x4) {
|
|
655
|
+
return _ref5.apply(this, arguments);
|
|
656
|
+
};
|
|
657
|
+
}()).then(function () {
|
|
658
|
+
alert('статья удалена ' + articleId);
|
|
659
|
+
})["catch"](function (err) {
|
|
660
|
+
console.error(err);
|
|
661
|
+
});
|
|
662
|
+
}
|
|
663
|
+
};
|
|
664
|
+
(0, _react.useEffect)(function () {
|
|
665
|
+
return function () {
|
|
666
|
+
var id = sessionStorage.getItem('delete-article');
|
|
667
|
+
var text = sessionStorage.getItem('delete-article-text');
|
|
668
|
+
if ((text === null || text === void 0 ? void 0 : text.length) < 1 && isNew) {
|
|
669
|
+
deleteArticle(id);
|
|
670
|
+
}
|
|
671
|
+
};
|
|
672
|
+
}, []);
|
|
673
|
+
(0, _react.useEffect)(function () {
|
|
674
|
+
fetchGetBreadcrumbs(apiData === null || apiData === void 0 ? void 0 : apiData.level_id, apiData === null || apiData === void 0 ? void 0 : apiData.id);
|
|
675
|
+
setSelectedItemId(apiData === null || apiData === void 0 ? void 0 : apiData.level_id);
|
|
676
|
+
}, [apiData]);
|
|
677
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
678
|
+
className: "article-and-tabs"
|
|
679
|
+
}, pageValue === 'article' && /*#__PURE__*/_react["default"].createElement("div", {
|
|
680
|
+
id: portalId,
|
|
681
|
+
className: "article-template article-template__content"
|
|
682
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
683
|
+
className: "article-template__content-article"
|
|
684
|
+
}, /*#__PURE__*/_react["default"].createElement(_ArticleViewV["default"], {
|
|
685
|
+
isNew: isNew,
|
|
686
|
+
articleTitle: articleTitle,
|
|
687
|
+
articleTitleRef: articleTitleRef,
|
|
688
|
+
setArticleTitle: function setArticleTitle(e) {
|
|
689
|
+
_setArticleTitle(e);
|
|
690
|
+
if (e) {
|
|
691
|
+
sessionStorage.setItem('delete-article-text', e);
|
|
692
|
+
}
|
|
693
|
+
},
|
|
694
|
+
setContentChanged: function setContentChanged(e) {
|
|
695
|
+
return _setContentChanged(e);
|
|
696
|
+
},
|
|
697
|
+
readonly: false,
|
|
698
|
+
loading: loading,
|
|
699
|
+
apiData: apiData,
|
|
700
|
+
contentData: contentData,
|
|
701
|
+
setContentData: setContentDataCallback,
|
|
702
|
+
setListOfContent: setContentLinks,
|
|
703
|
+
portalId: portalId,
|
|
704
|
+
publishEventSource: publishButtonRef.current,
|
|
705
|
+
setChanged: _setContentChanged,
|
|
706
|
+
title: seoTitle,
|
|
707
|
+
setTitle: function setTitle(e) {
|
|
708
|
+
return setSeoTitle(e);
|
|
709
|
+
},
|
|
710
|
+
description: seoDescription,
|
|
711
|
+
setDescription: function setDescription(e) {
|
|
712
|
+
return setSeoDescription(e);
|
|
713
|
+
},
|
|
714
|
+
contentLinks: contentLinks,
|
|
715
|
+
articleId: articleId,
|
|
716
|
+
hiddenSeo: true,
|
|
717
|
+
listLinks: listLinks,
|
|
718
|
+
setListLinks: setListLinks,
|
|
719
|
+
setBreadcrumbs: setBreadcrumbs,
|
|
720
|
+
fetchDataById: fetchDataById
|
|
721
|
+
})), /*#__PURE__*/_react["default"].createElement(_ListOfContent["default"], {
|
|
722
|
+
links: listLinks,
|
|
723
|
+
readingTime: readingTime,
|
|
724
|
+
tags: allTags,
|
|
725
|
+
selectedTags: tags,
|
|
726
|
+
onAddTagClick: onAddTagClick,
|
|
727
|
+
tagsSelectorDisabled: tagCreationInProgress,
|
|
728
|
+
setSelectedTags: function setSelectedTags(e) {
|
|
729
|
+
if (Object.keys(apiData).length) _setContentChanged(true);
|
|
730
|
+
setTags(e);
|
|
731
|
+
},
|
|
732
|
+
views: views,
|
|
733
|
+
publicationDate: publicationDate,
|
|
734
|
+
author: author,
|
|
735
|
+
articlePath: "/wiki" + (apiData === null || apiData === void 0 ? void 0 : apiData.friendlyURL)
|
|
736
|
+
})), pageValue === 'seo' && /*#__PURE__*/_react["default"].createElement("div", {
|
|
737
|
+
id: portalId,
|
|
738
|
+
className: "article-template article-template__content"
|
|
739
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
740
|
+
className: "article-template__content-article"
|
|
741
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
742
|
+
className: "container",
|
|
743
|
+
style: {
|
|
744
|
+
background: '#fff',
|
|
745
|
+
borderRadius: 12,
|
|
746
|
+
padding: '1em',
|
|
747
|
+
display: 'flex',
|
|
748
|
+
flexDirection: 'column',
|
|
749
|
+
gap: '1em'
|
|
750
|
+
}
|
|
751
|
+
}, /*#__PURE__*/_react["default"].createElement("h2", null, "\u0421\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043A\u0430 \u0442\u0435\u043A\u0441\u0442\u0430"), /*#__PURE__*/_react["default"].createElement(_TableBox["default"], {
|
|
752
|
+
loading: tableLoading,
|
|
753
|
+
fetchedData: tableData,
|
|
754
|
+
headers: tableHeaders,
|
|
755
|
+
hideHeader: true
|
|
756
|
+
})))), pageValue === 'seo-setup' && /*#__PURE__*/_react["default"].createElement("div", {
|
|
757
|
+
id: portalId,
|
|
758
|
+
className: "article-template article-template__content"
|
|
759
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
760
|
+
className: "article-template__content-article"
|
|
761
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
762
|
+
className: "container",
|
|
763
|
+
style: {
|
|
764
|
+
background: '#fff',
|
|
765
|
+
borderRadius: 12,
|
|
766
|
+
padding: '1em',
|
|
767
|
+
display: 'flex',
|
|
768
|
+
flexDirection: 'column',
|
|
769
|
+
gap: '1em'
|
|
770
|
+
}
|
|
771
|
+
}, /*#__PURE__*/_react["default"].createElement("h2", null, "\u041D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0430 SEO"), /*#__PURE__*/_react["default"].createElement("div", {
|
|
772
|
+
className: "article__input-group"
|
|
773
|
+
})))));
|
|
774
|
+
};
|
|
775
|
+
var _default = exports["default"] = ArticleWiki;
|