gwchq-textjam 0.2.4 → 0.2.6
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/index.js
CHANGED
|
@@ -64600,8 +64600,7 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
|
|
|
64600
64600
|
|
|
64601
64601
|
function SvgGwcLogo(props) {
|
|
64602
64602
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("svg", _extends({
|
|
64603
|
-
|
|
64604
|
-
height: 44,
|
|
64603
|
+
viewBox: "0 0 44 44",
|
|
64605
64604
|
fill: "none",
|
|
64606
64605
|
xmlns: "http://www.w3.org/2000/svg"
|
|
64607
64606
|
}, props), _rect || (_rect = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("rect", {
|
|
@@ -65891,14 +65890,13 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
|
|
|
65891
65890
|
|
|
65892
65891
|
function SvgShare(props) {
|
|
65893
65892
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("svg", _extends({
|
|
65894
|
-
|
|
65895
|
-
height: 20,
|
|
65893
|
+
viewBox: "0 0 19 20",
|
|
65896
65894
|
fill: "none",
|
|
65897
65895
|
xmlns: "http://www.w3.org/2000/svg"
|
|
65898
65896
|
}, props), _path || (_path = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("path", {
|
|
65899
65897
|
d: "M6.031 11.359l6.147 3.582m-.009-9.882L6.031 8.641M17.2 3.7a2.7 2.7 0 11-5.4 0 2.7 2.7 0 015.4 0zM6.4 10A2.7 2.7 0 111 10a2.7 2.7 0 015.4 0zm10.8 6.3a2.7 2.7 0 11-5.4 0 2.7 2.7 0 015.4 0z",
|
|
65900
65898
|
stroke: "#003046",
|
|
65901
|
-
strokeWidth:
|
|
65899
|
+
strokeWidth: 1.5,
|
|
65902
65900
|
strokeLinecap: "round",
|
|
65903
65901
|
strokeLinejoin: "round"
|
|
65904
65902
|
})));
|
|
@@ -66150,8 +66148,7 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
|
|
|
66150
66148
|
|
|
66151
66149
|
function SvgTextJamLogo(props) {
|
|
66152
66150
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("svg", _extends({
|
|
66153
|
-
|
|
66154
|
-
height: 36,
|
|
66151
|
+
viewBox: "0 0 155 36",
|
|
66155
66152
|
fill: "none",
|
|
66156
66153
|
xmlns: "http://www.w3.org/2000/svg"
|
|
66157
66154
|
}, props), _path || (_path = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("path", {
|
|
@@ -68347,8 +68344,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
68347
68344
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
68348
68345
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
68349
68346
|
/* harmony export */ });
|
|
68350
|
-
/* harmony import */ var
|
|
68351
|
-
/* harmony import */ var
|
|
68347
|
+
/* harmony import */ var D_gwc2_gwchq_textjam_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(89379);
|
|
68348
|
+
/* harmony import */ var D_gwc2_gwchq_textjam_node_modules_babel_runtime_helpers_esm_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(53986);
|
|
68352
68349
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(51649);
|
|
68353
68350
|
/* harmony import */ var _hello_pangea_dnd__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(98850);
|
|
68354
68351
|
/* harmony import */ var react_redux__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(14062);
|
|
@@ -68372,7 +68369,7 @@ var DraggableTab = _ref => {
|
|
|
68372
68369
|
panelIndex,
|
|
68373
68370
|
fileIndex
|
|
68374
68371
|
} = _ref,
|
|
68375
|
-
otherProps = (0,
|
|
68372
|
+
otherProps = (0,D_gwc2_gwchq_textjam_node_modules_babel_runtime_helpers_esm_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A)(_ref, _excluded);
|
|
68376
68373
|
var openFiles = (0,react_redux__WEBPACK_IMPORTED_MODULE_1__.useSelector)(state => state.editor.openedFiles);
|
|
68377
68374
|
var openFilesCount = openFiles[panelIndex].length;
|
|
68378
68375
|
var dispatch = (0,react_redux__WEBPACK_IMPORTED_MODULE_1__.useDispatch)();
|
|
@@ -68389,7 +68386,7 @@ var DraggableTab = _ref => {
|
|
|
68389
68386
|
switchToFileTab(panelIndex, (fileIndex + openFilesCount - 1) % openFilesCount);
|
|
68390
68387
|
}
|
|
68391
68388
|
};
|
|
68392
|
-
var InnerTab = () => /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(react_tabs__WEBPACK_IMPORTED_MODULE_2__.Tab, (0,
|
|
68389
|
+
var InnerTab = () => /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(react_tabs__WEBPACK_IMPORTED_MODULE_2__.Tab, (0,D_gwc2_gwchq_textjam_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .A)((0,D_gwc2_gwchq_textjam_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .A)({
|
|
68393
68390
|
onClick: e => {
|
|
68394
68391
|
e.stopPropagation();
|
|
68395
68392
|
switchToFileTab(panelIndex, fileIndex);
|
|
@@ -68407,7 +68404,7 @@ var DraggableTab = _ref => {
|
|
|
68407
68404
|
draggableProps,
|
|
68408
68405
|
dragHandleProps
|
|
68409
68406
|
} = _ref2;
|
|
68410
|
-
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("div", (0,
|
|
68407
|
+
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("div", (0,D_gwc2_gwchq_textjam_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .A)((0,D_gwc2_gwchq_textjam_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .A)((0,D_gwc2_gwchq_textjam_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .A)({
|
|
68411
68408
|
className: "draggable-tab",
|
|
68412
68409
|
ref: innerRef
|
|
68413
68410
|
}, draggableProps), dragHandleProps), {}, {
|
|
@@ -68429,8 +68426,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
68429
68426
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
68430
68427
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
68431
68428
|
/* harmony export */ });
|
|
68432
|
-
/* harmony import */ var
|
|
68433
|
-
/* harmony import */ var
|
|
68429
|
+
/* harmony import */ var D_gwc2_gwchq_textjam_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(89379);
|
|
68430
|
+
/* harmony import */ var D_gwc2_gwchq_textjam_node_modules_babel_runtime_helpers_esm_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(53986);
|
|
68434
68431
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(51649);
|
|
68435
68432
|
/* harmony import */ var _hello_pangea_dnd__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(98850);
|
|
68436
68433
|
/* harmony import */ var react_tabs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(39243);
|
|
@@ -68449,8 +68446,8 @@ var DroppableTabList = _ref => {
|
|
|
68449
68446
|
children: _children,
|
|
68450
68447
|
index
|
|
68451
68448
|
} = _ref,
|
|
68452
|
-
otherProps = (0,
|
|
68453
|
-
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(react_tabs__WEBPACK_IMPORTED_MODULE_1__.TabList, (0,
|
|
68449
|
+
otherProps = (0,D_gwc2_gwchq_textjam_node_modules_babel_runtime_helpers_esm_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .A)(_ref, _excluded);
|
|
68450
|
+
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(react_tabs__WEBPACK_IMPORTED_MODULE_1__.TabList, (0,D_gwc2_gwchq_textjam_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A)((0,D_gwc2_gwchq_textjam_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A)({}, otherProps), {}, {
|
|
68454
68451
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_hello_pangea_dnd__WEBPACK_IMPORTED_MODULE_6__.Droppable, {
|
|
68455
68452
|
direction: "horizontal",
|
|
68456
68453
|
droppableId: index.toString(),
|
|
@@ -68460,7 +68457,7 @@ var DroppableTabList = _ref => {
|
|
|
68460
68457
|
droppableProps,
|
|
68461
68458
|
placeholder
|
|
68462
68459
|
} = _ref2;
|
|
68463
|
-
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("div", (0,
|
|
68460
|
+
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("div", (0,D_gwc2_gwchq_textjam_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A)((0,D_gwc2_gwchq_textjam_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A)({
|
|
68464
68461
|
className: "droppable-tab-list"
|
|
68465
68462
|
}, droppableProps), {}, {
|
|
68466
68463
|
ref: innerRef,
|
|
@@ -102288,6 +102285,102 @@ var BaseModal = _ref => {
|
|
|
102288
102285
|
|
|
102289
102286
|
/***/ }),
|
|
102290
102287
|
|
|
102288
|
+
/***/ 94778:
|
|
102289
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
102290
|
+
|
|
102291
|
+
// ESM COMPAT FLAG
|
|
102292
|
+
__webpack_require__.r(__webpack_exports__);
|
|
102293
|
+
|
|
102294
|
+
// EXPORTS
|
|
102295
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
102296
|
+
"default": () => (/* binding */ DraftUnsavedChangesModal_DraftUnsavedChangesModal)
|
|
102297
|
+
});
|
|
102298
|
+
|
|
102299
|
+
// EXTERNAL MODULE: external "react-redux"
|
|
102300
|
+
var external_react_redux_ = __webpack_require__(14062);
|
|
102301
|
+
// EXTERNAL MODULE: ./src/components/Modals/BaseModal/BaseModal.jsx
|
|
102302
|
+
var BaseModal = __webpack_require__(94738);
|
|
102303
|
+
// EXTERNAL MODULE: ./src/components/Button/Button.jsx + 1 modules
|
|
102304
|
+
var Button = __webpack_require__(60232);
|
|
102305
|
+
// EXTERNAL MODULE: ./src/components/shared/SvgIcon/index.tsx
|
|
102306
|
+
var SvgIcon = __webpack_require__(82917);
|
|
102307
|
+
// EXTERNAL MODULE: ./src/assets/icons/alertTriangle.svg
|
|
102308
|
+
var alertTriangle = __webpack_require__(30103);
|
|
102309
|
+
// EXTERNAL MODULE: ./src/redux/EditorSlice.ts
|
|
102310
|
+
var EditorSlice = __webpack_require__(68512);
|
|
102311
|
+
// EXTERNAL MODULE: ./src/redux/types.ts
|
|
102312
|
+
var types = __webpack_require__(92932);
|
|
102313
|
+
// EXTERNAL MODULE: ./src/redux/stores/index.ts
|
|
102314
|
+
var stores = __webpack_require__(32132);
|
|
102315
|
+
;// ./src/components/Modals/DraftUnsavedChangesModal/styles.module.scss
|
|
102316
|
+
// extracted by mini-css-extract-plugin
|
|
102317
|
+
/* harmony default export */ const styles_module = ({"grey-rpi-grey-15":"#d5d7dc","grey-rpi-grey-40":"#9497a4","grey-rpi-grey-5":"#f1f2f3","grey-rpi-grey-70":"#4a4d59","grey-rpf-white":"#fff","content":"styles-module__content--Xo0FC","body":"styles-module__body--t9rtp","buttonsContainer":"styles-module__buttonsContainer--JGhSm","headerText":"styles-module__headerText--pmvJm","headerIcon":"styles-module__headerIcon--3TJZO","description":"styles-module__description--uzzI+"});
|
|
102318
|
+
// EXTERNAL MODULE: ./src/components/Modals/BaseModal/styles.module.scss
|
|
102319
|
+
var BaseModal_styles_module = __webpack_require__(41809);
|
|
102320
|
+
// EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js
|
|
102321
|
+
var jsx_runtime = __webpack_require__(74848);
|
|
102322
|
+
;// ./src/components/Modals/DraftUnsavedChangesModal/DraftUnsavedChangesModal.js
|
|
102323
|
+
|
|
102324
|
+
|
|
102325
|
+
|
|
102326
|
+
|
|
102327
|
+
|
|
102328
|
+
|
|
102329
|
+
|
|
102330
|
+
|
|
102331
|
+
|
|
102332
|
+
|
|
102333
|
+
|
|
102334
|
+
var DraftUnsavedChangesModal = () => {
|
|
102335
|
+
var dispatch = (0,external_react_redux_.useDispatch)();
|
|
102336
|
+
var isModalOpen = (0,stores.useAppSelector)(state => state.editor.modalWindowShowing === types.ModalType.DRAFT_UNSAVED_CHANGES);
|
|
102337
|
+
var args = (0,stores.useAppSelector)(state => state.editor.modalWindowArgs);
|
|
102338
|
+
if (!isModalOpen || !args || args.type !== types.ModalType.DRAFT_UNSAVED_CHANGES) {
|
|
102339
|
+
return null;
|
|
102340
|
+
}
|
|
102341
|
+
var handleClose = () => dispatch((0,EditorSlice.closeModal)());
|
|
102342
|
+
var handleContinue = () => {
|
|
102343
|
+
args.onContinue();
|
|
102344
|
+
handleClose();
|
|
102345
|
+
};
|
|
102346
|
+
var handleStartNew = () => {
|
|
102347
|
+
args.onStartNew();
|
|
102348
|
+
handleClose();
|
|
102349
|
+
};
|
|
102350
|
+
return /*#__PURE__*/(0,jsx_runtime.jsxs)(BaseModal["default"], {
|
|
102351
|
+
isOpen: isModalOpen,
|
|
102352
|
+
closeModal: handleClose,
|
|
102353
|
+
externalClasses: styles_module,
|
|
102354
|
+
heading: "",
|
|
102355
|
+
buttons: [/*#__PURE__*/(0,jsx_runtime.jsx)(Button["default"], {
|
|
102356
|
+
variant: "primary",
|
|
102357
|
+
buttonText: "Continue",
|
|
102358
|
+
onClickHandler: handleContinue
|
|
102359
|
+
}, "continue"), /*#__PURE__*/(0,jsx_runtime.jsx)(Button["default"], {
|
|
102360
|
+
variant: "tertiaryGray",
|
|
102361
|
+
buttonText: "Start New Project",
|
|
102362
|
+
onClickHandler: handleStartNew
|
|
102363
|
+
}, "start-new")],
|
|
102364
|
+
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
102365
|
+
className: BaseModal_styles_module["default"].headerContainer,
|
|
102366
|
+
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(SvgIcon.SvgIcon, {
|
|
102367
|
+
size: 24,
|
|
102368
|
+
SvgElement: alertTriangle["default"],
|
|
102369
|
+
className: styles_module.headerIcon
|
|
102370
|
+
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
102371
|
+
className: "".concat(BaseModal_styles_module["default"].headerText, " ").concat(styles_module.headerText),
|
|
102372
|
+
children: "Unsaved Changes Detected"
|
|
102373
|
+
})]
|
|
102374
|
+
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
102375
|
+
className: styles_module.description,
|
|
102376
|
+
children: "We found unsaved changes.\n Would you like to continue where you left off or start a new project?"
|
|
102377
|
+
})]
|
|
102378
|
+
});
|
|
102379
|
+
};
|
|
102380
|
+
/* harmony default export */ const DraftUnsavedChangesModal_DraftUnsavedChangesModal = (DraftUnsavedChangesModal);
|
|
102381
|
+
|
|
102382
|
+
/***/ }),
|
|
102383
|
+
|
|
102291
102384
|
/***/ 95049:
|
|
102292
102385
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
102293
102386
|
|
|
@@ -102918,7 +103011,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
102918
103011
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
102919
103012
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
102920
103013
|
/* harmony export */ });
|
|
102921
|
-
/* harmony import */ var
|
|
103014
|
+
/* harmony import */ var D_gwc2_gwchq_textjam_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(89379);
|
|
102922
103015
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(51649);
|
|
102923
103016
|
/* harmony import */ var react_redux__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(14062);
|
|
102924
103017
|
/* harmony import */ var _redux_EditorSlice__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(68512);
|
|
@@ -102998,7 +103091,7 @@ var ProjectName = _ref => {
|
|
|
102998
103091
|
id: "project_name_label",
|
|
102999
103092
|
className: _styles_module_scss__WEBPACK_IMPORTED_MODULE_3__["default"].projectLabel,
|
|
103000
103093
|
children: "Project Name"
|
|
103001
|
-
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", (0,
|
|
103094
|
+
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", (0,D_gwc2_gwchq_textjam_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .A)((0,D_gwc2_gwchq_textjam_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .A)({
|
|
103002
103095
|
className: classnames__WEBPACK_IMPORTED_MODULE_2___default()(_styles_module_scss__WEBPACK_IMPORTED_MODULE_3__["default"].projectName, className)
|
|
103003
103096
|
}, hoverProps), {}, {
|
|
103004
103097
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)((components_Tooltip_Tooltip__WEBPACK_IMPORTED_MODULE_8___default()), {
|
|
@@ -142795,7 +142888,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
142795
142888
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
142796
142889
|
/* harmony export */ });
|
|
142797
142890
|
// extracted by mini-css-extract-plugin
|
|
142798
|
-
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({"grey-rpi-grey-15":"#d5d7dc","grey-rpi-grey-40":"#9497a4","grey-rpi-grey-5":"#f1f2f3","grey-rpi-grey-70":"#4a4d59","grey-rpf-white":"#fff","sidebar":"styles-module__sidebar--Fu5Qi","
|
|
142891
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({"grey-rpi-grey-15":"#d5d7dc","grey-rpi-grey-40":"#9497a4","grey-rpi-grey-5":"#f1f2f3","grey-rpi-grey-70":"#4a4d59","grey-rpf-white":"#fff","sidebar":"styles-module__sidebar--Fu5Qi","bar":"styles-module__bar--fOlLf","optionsTop":"styles-module__optionsTop--2jNbs","optionsBottom":"styles-module__optionsBottom--PtwF4","option":"styles-module__option--MOGCu","userOption":"styles-module__userOption--qGt5j","selected":"styles-module__selected--avjSK","panel":"styles-module__panel--bHhSv","panelWithFooter":"styles-module__panelWithFooter--5ItsY","panelHeading":"styles-module__panelHeading--GRNt0","panelHeader":"styles-module__panelHeader--bAHfN","panelContent":"styles-module__panelContent--X7kot","panelButtons":"styles-module__panelButtons---y4S-","panelFooter":"styles-module__panelFooter--T1y-s"});
|
|
142799
142892
|
|
|
142800
142893
|
/***/ }),
|
|
142801
142894
|
|
|
@@ -371765,17 +371858,9 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
371765
371858
|
const jsx_runtime_1 = __webpack_require__(74848);
|
|
371766
371859
|
const ContextMenu_1 = __importDefault(__webpack_require__(39179));
|
|
371767
371860
|
const AuthContext_1 = __webpack_require__(55471);
|
|
371768
|
-
const BeforeUnloadContext_1 = __webpack_require__(2373);
|
|
371769
371861
|
const UserMenu = (props) => {
|
|
371770
371862
|
const { anchorRef, opened, onClose } = props;
|
|
371771
371863
|
const { onLogout, onViewProfile } = (0, AuthContext_1.useAuthActions)();
|
|
371772
|
-
const beforeUnloadRef = (0, BeforeUnloadContext_1.useBeforeUnload)();
|
|
371773
|
-
const handleLogout = () => {
|
|
371774
|
-
if (beforeUnloadRef?.current) {
|
|
371775
|
-
window.removeEventListener("beforeunload", beforeUnloadRef.current);
|
|
371776
|
-
}
|
|
371777
|
-
onLogout();
|
|
371778
|
-
};
|
|
371779
371864
|
return ((0, jsx_runtime_1.jsx)(ContextMenu_1.default, { align: "start", direction: "top", menuWidth: 142, menuOptions: [
|
|
371780
371865
|
{
|
|
371781
371866
|
text: "View Profile",
|
|
@@ -371783,7 +371868,7 @@ const UserMenu = (props) => {
|
|
|
371783
371868
|
},
|
|
371784
371869
|
{
|
|
371785
371870
|
text: "Logout",
|
|
371786
|
-
action:
|
|
371871
|
+
action: onLogout,
|
|
371787
371872
|
},
|
|
371788
371873
|
], opened: opened, anchorRef: anchorRef, onClose: onClose, gap: 4 }));
|
|
371789
371874
|
};
|
|
@@ -371998,6 +372083,7 @@ const SaveProjectReminderModal_1 = __importDefault(__webpack_require__(66536));
|
|
|
371998
372083
|
const UploadSizeLimitModal_1 = __importDefault(__webpack_require__(16893));
|
|
371999
372084
|
const UploadFilesModal_1 = __importDefault(__webpack_require__(9825));
|
|
372000
372085
|
const RemixProjectModal_1 = __importDefault(__webpack_require__(45829));
|
|
372086
|
+
const DraftUnsavedChangesModal_1 = __importDefault(__webpack_require__(94778));
|
|
372001
372087
|
exports.ModalTypeToComponentMap = {
|
|
372002
372088
|
[types_1.ModalType.SHARE_PROJECT]: (0, jsx_runtime_1.jsx)(ShareProjectModal_1.default, {}),
|
|
372003
372089
|
[types_1.ModalType.REMOVE_ITEM]: (0, jsx_runtime_1.jsx)(RemoveItemModal_1.default, {}),
|
|
@@ -372006,6 +372092,7 @@ exports.ModalTypeToComponentMap = {
|
|
|
372006
372092
|
[types_1.ModalType.UPLOAD_SIZE_LIMIT]: (0, jsx_runtime_1.jsx)(UploadSizeLimitModal_1.default, {}),
|
|
372007
372093
|
[types_1.ModalType.UPLOAD_FILES]: (0, jsx_runtime_1.jsx)(UploadFilesModal_1.default, {}),
|
|
372008
372094
|
[types_1.ModalType.REMIX_PROJECT]: (0, jsx_runtime_1.jsx)(RemixProjectModal_1.default, {}),
|
|
372095
|
+
[types_1.ModalType.DRAFT_UNSAVED_CHANGES]: (0, jsx_runtime_1.jsx)(DraftUnsavedChangesModal_1.default, {}),
|
|
372009
372096
|
};
|
|
372010
372097
|
|
|
372011
372098
|
|
|
@@ -372150,6 +372237,7 @@ const types_1 = __webpack_require__(92932);
|
|
|
372150
372237
|
const stores_1 = __webpack_require__(32132);
|
|
372151
372238
|
const useHover_1 = __webpack_require__(78556);
|
|
372152
372239
|
const styles_module_scss_1 = __importDefault(__webpack_require__(99855));
|
|
372240
|
+
const SvgIcon_1 = __webpack_require__(82917);
|
|
372153
372241
|
const ShareButton = (props) => {
|
|
372154
372242
|
const dispatch = (0, react_redux_1.useDispatch)();
|
|
372155
372243
|
const shareLinks = (0, stores_1.useAppSelector)((state) => state.editor.shareLinks);
|
|
@@ -372166,7 +372254,7 @@ const ShareButton = (props) => {
|
|
|
372166
372254
|
}, [dispatch, shareLinks]);
|
|
372167
372255
|
const canShare = Boolean(shareLinks);
|
|
372168
372256
|
const { hovered, hoverProps } = (0, useHover_1.useHover)();
|
|
372169
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.shareButtonWrapper, ...hoverProps, children: [(0, jsx_runtime_1.jsx)(Tooltip_1.default, { message: "To share your project, please save it first.", visible: hovered && !canShare, position: "bottom" }), (0, jsx_runtime_1.jsx)(Button_1.default, { disabled: !canShare, variant: "tertiary", ButtonIcon: share_svg_1.default, onClickHandler: onClickShare, ...props })] }));
|
|
372257
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.shareButtonWrapper, ...hoverProps, children: [(0, jsx_runtime_1.jsx)(Tooltip_1.default, { message: "To share your project, please save it first.", visible: hovered && !canShare, position: "bottom" }), (0, jsx_runtime_1.jsx)(Button_1.default, { disabled: !canShare, variant: "tertiary", ButtonIcon: () => (0, jsx_runtime_1.jsx)(SvgIcon_1.SvgIcon, { SvgElement: share_svg_1.default, size: 24 }), onClickHandler: onClickShare, ...props })] }));
|
|
372170
372258
|
};
|
|
372171
372259
|
exports["default"] = ShareButton;
|
|
372172
372260
|
|
|
@@ -372352,7 +372440,7 @@ const WebComponentProject = ({ nameEditable = false, sidebarOptions = [], packag
|
|
|
372352
372440
|
return () => clearTimeout(timeout);
|
|
372353
372441
|
}, [project]);
|
|
372354
372442
|
renderer.link = function (data) {
|
|
372355
|
-
return `<a href="${data.href}" target="_blank" rel="noreferrer"
|
|
372443
|
+
return `<a href="${data.href}" target="_blank" rel="noreferrer"
|
|
372356
372444
|
}">${data.text}</a>`;
|
|
372357
372445
|
};
|
|
372358
372446
|
marked_1.marked.setOptions({
|
|
@@ -372478,7 +372566,6 @@ const ToastMessages_1 = __webpack_require__(6459);
|
|
|
372478
372566
|
const Modals_1 = __webpack_require__(18284);
|
|
372479
372567
|
const Loading_1 = __importDefault(__webpack_require__(34466));
|
|
372480
372568
|
const stores_1 = __webpack_require__(32132);
|
|
372481
|
-
const BeforeUnloadContext_1 = __webpack_require__(2373);
|
|
372482
372569
|
const SaveBeforeLeave_1 = __webpack_require__(47318);
|
|
372483
372570
|
const selectors_1 = __webpack_require__(43551);
|
|
372484
372571
|
const WebComponentLoader = (props) => {
|
|
@@ -372593,7 +372680,6 @@ const WebComponentLoader = (props) => {
|
|
|
372593
372680
|
}, []);
|
|
372594
372681
|
const modal = (modalWindowShowing && Modals_1.ModalTypeToComponentMap[modalWindowShowing]) ?? null;
|
|
372595
372682
|
const isReadOnly = (0, stores_1.useAppSelector)((state) => state.editor.readOnly);
|
|
372596
|
-
const beforeUnloadRef = (0, react_1.useRef)(null);
|
|
372597
372683
|
const shouldBlockNavigation = (0, stores_1.useAppSelector)(selectors_1.selectProjectDirtyState);
|
|
372598
372684
|
// effect for browser actions (refresh, tab close etc)
|
|
372599
372685
|
(0, react_1.useEffect)(() => {
|
|
@@ -372605,17 +372691,15 @@ const WebComponentLoader = (props) => {
|
|
|
372605
372691
|
// for browsers to show the confirmation dialog
|
|
372606
372692
|
e.returnValue = "";
|
|
372607
372693
|
};
|
|
372608
|
-
beforeUnloadRef.current = handleBeforeUnload;
|
|
372609
372694
|
window.addEventListener("beforeunload", handleBeforeUnload);
|
|
372610
372695
|
return () => {
|
|
372611
372696
|
window.removeEventListener("beforeunload", handleBeforeUnload);
|
|
372612
|
-
beforeUnloadRef.current = null;
|
|
372613
372697
|
};
|
|
372614
|
-
}, [isPreviewMode, isReadOnly
|
|
372615
|
-
const renderSuccessState = () => ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.
|
|
372616
|
-
|
|
372617
|
-
|
|
372618
|
-
|
|
372698
|
+
}, [shouldBlockNavigation, isPreviewMode, isReadOnly]);
|
|
372699
|
+
const renderSuccessState = () => ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)(settings_1.SettingsContext.Provider, { value: {
|
|
372700
|
+
theme: themeDefault,
|
|
372701
|
+
fontSize: "small",
|
|
372702
|
+
}, children: [(0, jsx_runtime_1.jsx)(ToastMessages_1.ToastMessagesProvider, {}), (0, jsx_runtime_1.jsxs)("div", { id: "textjam-root", className: `editor-shell --${themeDefault}`, children: [(0, jsx_runtime_1.jsx)(WebComponentProject_1.default, { nameEditable: projectNameEditable, sidebarOptions: sidebarOptions, packageApiUrl: packageApiUrl }), errorModalShowing && (0, jsx_runtime_1.jsx)(ErrorModal_1.default, {}), modal, shouldBlockNavigation && (0, jsx_runtime_1.jsx)(SaveBeforeLeave_1.SaveBeforeLeaveModal, {})] })] }) }));
|
|
372619
372703
|
const renderFailedState = () => ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)("p", { children: t("webComponent.failed") }) }));
|
|
372620
372704
|
const renderLoadingState = () => (0, jsx_runtime_1.jsx)(Loading_1.default, {});
|
|
372621
372705
|
if (loading === types_1.LoadingState.SUCCESS) {
|
|
@@ -372656,20 +372740,6 @@ const useAuthActions = () => {
|
|
|
372656
372740
|
exports.useAuthActions = useAuthActions;
|
|
372657
372741
|
|
|
372658
372742
|
|
|
372659
|
-
/***/ }),
|
|
372660
|
-
|
|
372661
|
-
/***/ 2373:
|
|
372662
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
372663
|
-
|
|
372664
|
-
|
|
372665
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
372666
|
-
exports.useBeforeUnload = exports.BeforeUnloadContext = void 0;
|
|
372667
|
-
const react_1 = __webpack_require__(51649);
|
|
372668
|
-
exports.BeforeUnloadContext = (0, react_1.createContext)(null);
|
|
372669
|
-
const useBeforeUnload = () => (0, react_1.useContext)(exports.BeforeUnloadContext);
|
|
372670
|
-
exports.useBeforeUnload = useBeforeUnload;
|
|
372671
|
-
|
|
372672
|
-
|
|
372673
372743
|
/***/ }),
|
|
372674
372744
|
|
|
372675
372745
|
/***/ 59578:
|
|
@@ -373376,6 +373446,7 @@ const useIsMounted_1 = __webpack_require__(76314);
|
|
|
373376
373446
|
const useProjectCache_1 = __webpack_require__(69557);
|
|
373377
373447
|
const helpers_1 = __webpack_require__(59578);
|
|
373378
373448
|
const sendToast_1 = __webpack_require__(50068);
|
|
373449
|
+
const useUnsavedDraftResolution_1 = __webpack_require__(61171);
|
|
373379
373450
|
const buildProjectSnapshot_1 = __webpack_require__(10533);
|
|
373380
373451
|
const isFinalLoadingState = (state) => state === types_1.LoadingState.SUCCESS || state === types_1.LoadingState.FAILED;
|
|
373381
373452
|
const useProject = ({ projectData, projectContent = null, isContentLoaded = null, isLoading = false, loadProjectContent, loadTemplateProjectData, isTemplateDataLoaded, }) => {
|
|
@@ -373390,23 +373461,37 @@ const useProject = ({ projectData, projectContent = null, isContentLoaded = null
|
|
|
373390
373461
|
const cacheKey = project.identifier ?? projectData?.identifier;
|
|
373391
373462
|
const projectLoadCallIdRef = (0, react_1.useRef)(null);
|
|
373392
373463
|
const { value: cachedProject, isLoading: isLoadingCache, isLoaded: isCacheLoaded, } = (0, useProjectCache_1.useProjectCache)(cacheKey);
|
|
373464
|
+
// treat commitId null and undefined as equal and not as commit outdated
|
|
373465
|
+
// eslint-disable-next-line eqeqeq
|
|
373466
|
+
const isCurrentOutdated = cachedProject?.commitId != projectData?.commitId;
|
|
373467
|
+
const { shouldBypassCachedDraft, shouldShowUnsavedDraftModal, openUnsavedDraftModal, } = (0, useUnsavedDraftResolution_1.useUnsavedDraftResolution)({
|
|
373468
|
+
projectData,
|
|
373469
|
+
cachedProject,
|
|
373470
|
+
isCurrentOutdated,
|
|
373471
|
+
});
|
|
373472
|
+
const prepareTemplateComponents = (sourceComponents = []) => {
|
|
373473
|
+
const componentsMap = new Map(sourceComponents.map((component) => [component.id, component]));
|
|
373474
|
+
return sourceComponents.map((component) => component.type === ProjectTypes_1.ProjectComponentType.DIR
|
|
373475
|
+
? {
|
|
373476
|
+
...component,
|
|
373477
|
+
children: (0, projectHelpers_1.sortChildren)([...(component.children ?? [])], componentsMap),
|
|
373478
|
+
}
|
|
373479
|
+
: component);
|
|
373480
|
+
};
|
|
373393
373481
|
// initial setup of project in case of creating from scratch
|
|
373394
373482
|
const setProjectDataFromTemplate = (0, react_1.useCallback)((incomingData) => {
|
|
373395
373483
|
// default project template is used as a fallback for fields that weren't provided
|
|
373396
373484
|
const defaultProject = (0, helpers_1.buildDefaultProject)(incomingData?.project_type);
|
|
373397
|
-
//
|
|
373485
|
+
// use incoming components when available, otherwise fallback to default template
|
|
373486
|
+
const sourceComponents = incomingData?.components ?? defaultProject.components ?? [];
|
|
373487
|
+
// clone components before sorting to avoid mutating frozen/template objects
|
|
373488
|
+
const preparedComponents = prepareTemplateComponents(sourceComponents);
|
|
373398
373489
|
const projectToSet = {
|
|
373399
373490
|
...defaultProject,
|
|
373400
373491
|
...incomingData,
|
|
373492
|
+
components: preparedComponents,
|
|
373401
373493
|
commitId: null,
|
|
373402
373494
|
};
|
|
373403
|
-
const componentsMap = new Map((projectToSet.components ?? []).map((comp) => [comp.id, comp]));
|
|
373404
|
-
// ensure all directory children are sorted
|
|
373405
|
-
for (const component of projectToSet.components ?? []) {
|
|
373406
|
-
if (component.type === ProjectTypes_1.ProjectComponentType.DIR) {
|
|
373407
|
-
component.children = (0, projectHelpers_1.sortChildren)(component.children ?? [], componentsMap);
|
|
373408
|
-
}
|
|
373409
|
-
}
|
|
373410
373495
|
dispatch((0, EditorSlice_1.setProject)(projectToSet));
|
|
373411
373496
|
}, [dispatch]);
|
|
373412
373497
|
// set initial project data on first load
|
|
@@ -373417,12 +373502,9 @@ const useProject = ({ projectData, projectContent = null, isContentLoaded = null
|
|
|
373417
373502
|
(!isCacheLoaded && cacheKey) ||
|
|
373418
373503
|
commitIdLoadTriggered)
|
|
373419
373504
|
return;
|
|
373420
|
-
if (isFinalLoadingState(loadingState))
|
|
373505
|
+
if (isFinalLoadingState(loadingState) && !shouldBypassCachedDraft)
|
|
373421
373506
|
return;
|
|
373422
373507
|
const hasNoData = !cachedProject && !projectContent;
|
|
373423
|
-
// treat commitId null and undefined as equal and not as commit outdated
|
|
373424
|
-
// eslint-disable-next-line eqeqeq
|
|
373425
|
-
const isCurrentOutdated = cachedProject?.commitId != projectData?.commitId;
|
|
373426
373508
|
const currentCommit = projectData?.commits?.find((commit) => commit.id === projectData?.commitId);
|
|
373427
373509
|
const cacheSavedAt = cachedProject?.savedAt
|
|
373428
373510
|
? new Date(cachedProject.savedAt).getTime()
|
|
@@ -373433,7 +373515,9 @@ const useProject = ({ projectData, projectContent = null, isContentLoaded = null
|
|
|
373433
373515
|
const isCacheNewerThanCurrentCommit = cacheSavedAt !== null &&
|
|
373434
373516
|
currentCommitCreatedAt !== null &&
|
|
373435
373517
|
cacheSavedAt > currentCommitCreatedAt;
|
|
373436
|
-
const shouldUseCache = !!cachedProject &&
|
|
373518
|
+
const shouldUseCache = !!cachedProject &&
|
|
373519
|
+
!shouldBypassCachedDraft &&
|
|
373520
|
+
(!isCurrentOutdated || isCacheNewerThanCurrentCommit);
|
|
373437
373521
|
// for preview mode, always load current cached project
|
|
373438
373522
|
if (isPreview) {
|
|
373439
373523
|
if (cachedProject)
|
|
@@ -373444,8 +373528,27 @@ const useProject = ({ projectData, projectContent = null, isContentLoaded = null
|
|
|
373444
373528
|
}
|
|
373445
373529
|
return;
|
|
373446
373530
|
}
|
|
373531
|
+
// if user has chosen start new for a draft, ignore cache completely
|
|
373532
|
+
if (!projectData?.commitId && shouldBypassCachedDraft) {
|
|
373533
|
+
if (!loadTemplateProjectData || isTemplateDataLoaded) {
|
|
373534
|
+
setProjectDataFromTemplate(projectData);
|
|
373535
|
+
dispatch((0, EditorSlice_1.setCommits)({ commits: projectData?.commits ?? [] }));
|
|
373536
|
+
}
|
|
373537
|
+
else {
|
|
373538
|
+
dispatch((0, EditorSlice_1.setLoading)(types_1.LoadingState.IDLE));
|
|
373539
|
+
loadTemplateProjectData?.();
|
|
373540
|
+
}
|
|
373541
|
+
return;
|
|
373542
|
+
}
|
|
373543
|
+
// same draft project - show modal before normal cache flow
|
|
373544
|
+
if (shouldShowUnsavedDraftModal && cachedProject) {
|
|
373545
|
+
dispatch((0, EditorSlice_1.setProject)(cachedProject));
|
|
373546
|
+
dispatch((0, EditorSlice_1.setCommits)({ commits: projectData?.commits ?? [] }));
|
|
373547
|
+
openUnsavedDraftModal();
|
|
373548
|
+
return;
|
|
373549
|
+
}
|
|
373447
373550
|
// if cached data found and it's usable, load from cache
|
|
373448
|
-
if (shouldUseCache) {
|
|
373551
|
+
if (shouldUseCache && cachedProject) {
|
|
373449
373552
|
dispatch((0, EditorSlice_1.setProject)(cachedProject));
|
|
373450
373553
|
dispatch((0, EditorSlice_1.setCommits)({ commits: projectData?.commits ?? [] }));
|
|
373451
373554
|
return;
|
|
@@ -373489,6 +373592,9 @@ const useProject = ({ projectData, projectContent = null, isContentLoaded = null
|
|
|
373489
373592
|
cacheKey,
|
|
373490
373593
|
isContentLoaded,
|
|
373491
373594
|
isTemplateDataLoaded,
|
|
373595
|
+
shouldBypassCachedDraft,
|
|
373596
|
+
shouldShowUnsavedDraftModal,
|
|
373597
|
+
openUnsavedDraftModal,
|
|
373492
373598
|
]);
|
|
373493
373599
|
// Load commit data when commitIdLoadTriggered is set
|
|
373494
373600
|
(0, react_1.useEffect)(() => {
|
|
@@ -373735,15 +373841,21 @@ const useProjectPersistence = ({ user, projectData, hasShownSavePrompt, saveProj
|
|
|
373735
373841
|
components: cleanedComponents,
|
|
373736
373842
|
identifier: projectData.identifier,
|
|
373737
373843
|
};
|
|
373844
|
+
const newLastSavedSnapshot = (0, buildProjectSnapshot_1.buildProjectSnapshot)(cleanedProject);
|
|
373738
373845
|
const updatedProjectSnapshot = {
|
|
373739
373846
|
components: cleanedComponents,
|
|
373740
373847
|
hasStructureChanges: false,
|
|
373741
|
-
lastSavedSnapshot:
|
|
373848
|
+
lastSavedSnapshot: newLastSavedSnapshot,
|
|
373742
373849
|
identifier: projectData.identifier,
|
|
373743
373850
|
};
|
|
373744
373851
|
dispatch((0, EditorSlice_1.updateProjectSnapshot)(updatedProjectSnapshot));
|
|
373852
|
+
upsertCacheValue(cleanedProject.identifier, {
|
|
373853
|
+
...cleanedProject,
|
|
373854
|
+
lastSavedSnapshot: newLastSavedSnapshot,
|
|
373855
|
+
});
|
|
373745
373856
|
}, [
|
|
373746
373857
|
deleteValueFromCache,
|
|
373858
|
+
upsertCacheValue,
|
|
373747
373859
|
dispatch,
|
|
373748
373860
|
project,
|
|
373749
373861
|
projectData?.identifier,
|
|
@@ -373915,6 +374027,57 @@ const useProjectTabSync = ({ projectKey, enabled = true, }) => {
|
|
|
373915
374027
|
exports.useProjectTabSync = useProjectTabSync;
|
|
373916
374028
|
|
|
373917
374029
|
|
|
374030
|
+
/***/ }),
|
|
374031
|
+
|
|
374032
|
+
/***/ 61171:
|
|
374033
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
374034
|
+
|
|
374035
|
+
|
|
374036
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
374037
|
+
exports.useUnsavedDraftResolution = void 0;
|
|
374038
|
+
const react_1 = __webpack_require__(51649);
|
|
374039
|
+
const react_redux_1 = __webpack_require__(14062);
|
|
374040
|
+
const EditorSlice_1 = __webpack_require__(68512);
|
|
374041
|
+
const types_1 = __webpack_require__(92932);
|
|
374042
|
+
// check if incoming and cached projects are the same draft
|
|
374043
|
+
const isSameDraftProjectType = (incomingProject, cachedProject) => {
|
|
374044
|
+
if (!incomingProject || !cachedProject)
|
|
374045
|
+
return false;
|
|
374046
|
+
return (!incomingProject.commitId &&
|
|
374047
|
+
cachedProject.identifier === incomingProject.identifier &&
|
|
374048
|
+
cachedProject.project_type === incomingProject.project_type &&
|
|
374049
|
+
cachedProject.extension === incomingProject.extension);
|
|
374050
|
+
};
|
|
374051
|
+
// handles unsaved draft logic and modal decision
|
|
374052
|
+
const useUnsavedDraftResolution = ({ projectData, cachedProject, isCurrentOutdated, }) => {
|
|
374053
|
+
const dispatch = (0, react_redux_1.useDispatch)();
|
|
374054
|
+
// flag to ignore cached draft after Start New
|
|
374055
|
+
const [shouldBypassCachedDraft, setShouldBypassCachedDraft] = (0, react_1.useState)(false);
|
|
374056
|
+
const isSameDraftType = (0, react_1.useMemo)(() => isSameDraftProjectType(projectData, cachedProject), [projectData, cachedProject]);
|
|
374057
|
+
// show modal only for matching draft when cache is valid and not bypassed
|
|
374058
|
+
const shouldShowUnsavedDraftModal = !!cachedProject &&
|
|
374059
|
+
!isCurrentOutdated &&
|
|
374060
|
+
!shouldBypassCachedDraft &&
|
|
374061
|
+
isSameDraftType;
|
|
374062
|
+
const openUnsavedDraftModal = (0, react_1.useCallback)(() => {
|
|
374063
|
+
dispatch((0, EditorSlice_1.showModal)({
|
|
374064
|
+
modal: types_1.ModalType.DRAFT_UNSAVED_CHANGES,
|
|
374065
|
+
args: {
|
|
374066
|
+
type: types_1.ModalType.DRAFT_UNSAVED_CHANGES,
|
|
374067
|
+
onContinue: () => setShouldBypassCachedDraft(false),
|
|
374068
|
+
onStartNew: () => setShouldBypassCachedDraft(true),
|
|
374069
|
+
},
|
|
374070
|
+
}));
|
|
374071
|
+
}, [dispatch]);
|
|
374072
|
+
return {
|
|
374073
|
+
shouldBypassCachedDraft,
|
|
374074
|
+
shouldShowUnsavedDraftModal,
|
|
374075
|
+
openUnsavedDraftModal,
|
|
374076
|
+
};
|
|
374077
|
+
};
|
|
374078
|
+
exports.useUnsavedDraftResolution = useUnsavedDraftResolution;
|
|
374079
|
+
|
|
374080
|
+
|
|
373918
374081
|
/***/ }),
|
|
373919
374082
|
|
|
373920
374083
|
/***/ 68512:
|
|
@@ -374660,6 +374823,7 @@ var ModalType;
|
|
|
374660
374823
|
ModalType["UPLOAD_SIZE_LIMIT"] = "uploadSizeLimit";
|
|
374661
374824
|
ModalType["UPLOAD_FILES"] = "uploadFiles";
|
|
374662
374825
|
ModalType["REMIX_PROJECT"] = "remixProject";
|
|
374826
|
+
ModalType["DRAFT_UNSAVED_CHANGES"] = "draftUnsavedChanges";
|
|
374663
374827
|
})(ModalType || (exports.ModalType = ModalType = {}));
|
|
374664
374828
|
var SavingState;
|
|
374665
374829
|
(function (SavingState) {
|
|
@@ -374919,6 +375083,7 @@ exports.IndexedDb = {
|
|
|
374919
375083
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
374920
375084
|
exports.LeaveGuardController = void 0;
|
|
374921
375085
|
const LeaveFlowSlice_1 = __webpack_require__(52990);
|
|
375086
|
+
const selectors_1 = __webpack_require__(43551);
|
|
374922
375087
|
class LeaveGuardController {
|
|
374923
375088
|
store;
|
|
374924
375089
|
pendingPromise = null;
|
|
@@ -374928,12 +375093,11 @@ class LeaveGuardController {
|
|
|
374928
375093
|
this.store = store;
|
|
374929
375094
|
}
|
|
374930
375095
|
canLeave = () => {
|
|
374931
|
-
|
|
374932
|
-
|
|
374933
|
-
|
|
374934
|
-
|
|
374935
|
-
|
|
374936
|
-
// }
|
|
375096
|
+
const state = this.store.getState();
|
|
375097
|
+
const isDirty = (0, selectors_1.selectProjectDirtyState)(state);
|
|
375098
|
+
if (!isDirty) {
|
|
375099
|
+
return Promise.resolve(true);
|
|
375100
|
+
}
|
|
374937
375101
|
if (this.pendingPromise) {
|
|
374938
375102
|
return this.pendingPromise;
|
|
374939
375103
|
}
|
|
@@ -383299,7 +383463,7 @@ module.exports = webpackAsyncContext;
|
|
|
383299
383463
|
/***/ 24427:
|
|
383300
383464
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
383301
383465
|
|
|
383302
|
-
module.exports = __webpack_require__.p + "assets/
|
|
383466
|
+
module.exports = __webpack_require__.p + "assets/PyodideWorker36d2ab735d3886128aa9.js";
|
|
383303
383467
|
|
|
383304
383468
|
/***/ }),
|
|
383305
383469
|
|