gwchq-textjam 0.1.63 → 0.1.65
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 +23 -20
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -106163,6 +106163,20 @@ var WebComponentLoader = props => {
|
|
|
106163
106163
|
i18n.changeLanguage(locale);
|
|
106164
106164
|
}
|
|
106165
106165
|
}, [locale, i18n]);
|
|
106166
|
+
(0,external_react_.useEffect)(() => {
|
|
106167
|
+
var cancelled = false;
|
|
106168
|
+
if (!(projectData !== null && projectData !== void 0 && projectData.templateId)) return;
|
|
106169
|
+
_asyncToGenerator(function* () {
|
|
106170
|
+
if (cancelled) return;
|
|
106171
|
+
var projectCache = yield IndexedDb.IndexedDb.getProject(projectData.identifier);
|
|
106172
|
+
if (!projectCache && !template.isLoading) {
|
|
106173
|
+
yield getTextJamTemplate(projectData.templateId);
|
|
106174
|
+
}
|
|
106175
|
+
return () => {
|
|
106176
|
+
cancelled = true;
|
|
106177
|
+
};
|
|
106178
|
+
})().catch(console.error);
|
|
106179
|
+
}, [projectData === null || projectData === void 0 ? void 0 : projectData.templateId]);
|
|
106166
106180
|
(0,useProject/* useProject */.U)({
|
|
106167
106181
|
identifier: projectData === null || projectData === void 0 ? void 0 : projectData.identifier,
|
|
106168
106182
|
projectData,
|
|
@@ -106192,21 +106206,6 @@ var WebComponentLoader = props => {
|
|
|
106192
106206
|
document.body.removeChild(script);
|
|
106193
106207
|
};
|
|
106194
106208
|
}, []);
|
|
106195
|
-
(0,external_react_.useEffect)(() => {
|
|
106196
|
-
var cancelled = false;
|
|
106197
|
-
if (!projectData) return;
|
|
106198
|
-
_asyncToGenerator(function* () {
|
|
106199
|
-
if (cancelled) return;
|
|
106200
|
-
var projectCache = yield IndexedDb.IndexedDb.getProject(projectData.identifier);
|
|
106201
|
-
if (!projectCache && !template.isLoading) {
|
|
106202
|
-
(0,EditorSlice.setLoading)(types.LoadingState.IDLE);
|
|
106203
|
-
yield getTextJamTemplate(projectData.templateId);
|
|
106204
|
-
}
|
|
106205
|
-
return () => {
|
|
106206
|
-
cancelled = true;
|
|
106207
|
-
};
|
|
106208
|
-
})().catch(console.error);
|
|
106209
|
-
}, [projectData === null || projectData === void 0 ? void 0 : projectData.templateId]);
|
|
106210
106209
|
var modal = (_ModalTypeToComponent = Modals.ModalTypeToComponentMap[modalWindowShowing]) !== null && _ModalTypeToComponent !== void 0 ? _ModalTypeToComponent : null;
|
|
106211
106210
|
var renderSuccessState = () => /*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
|
|
106212
106211
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(settings/* SettingsContext */.l.Provider, {
|
|
@@ -371237,6 +371236,7 @@ const react_router_dom_1 = __webpack_require__(92648);
|
|
|
371237
371236
|
const AuthContext_1 = __webpack_require__(55471);
|
|
371238
371237
|
__webpack_require__(72788);
|
|
371239
371238
|
const editorListener_1 = __webpack_require__(41824);
|
|
371239
|
+
const Loading_1 = __importDefault(__webpack_require__(34466));
|
|
371240
371240
|
(0, editorListener_1.registerEditorListeners)();
|
|
371241
371241
|
const TextJamEditor = ({ onLogoutClick = () => { }, onViewProfileClick = () => { }, onHomeClick = () => { }, getTextJamTemplate = (templateId) => { }, template = {
|
|
371242
371242
|
isLoading: false,
|
|
@@ -371263,7 +371263,7 @@ const TextJamEditor = ({ onLogoutClick = () => { }, onViewProfileClick = () => {
|
|
|
371263
371263
|
getTextJamTemplate,
|
|
371264
371264
|
template,
|
|
371265
371265
|
};
|
|
371266
|
-
return ((0, jsx_runtime_1.jsx)(react_1.default.StrictMode, { children: (0, jsx_runtime_1.jsx)("div", { id: "textjam-editor", children: (0, jsx_runtime_1.jsx)(react_1.Suspense, { fallback: (0, jsx_runtime_1.jsx)(
|
|
371266
|
+
return ((0, jsx_runtime_1.jsx)(react_1.default.StrictMode, { children: (0, jsx_runtime_1.jsx)("div", { id: "textjam-editor", children: (0, jsx_runtime_1.jsx)(react_1.Suspense, { fallback: (0, jsx_runtime_1.jsx)(Loading_1.default, {}), children: (0, jsx_runtime_1.jsx)(react_redux_1.Provider, { store: stores_1.default, children: (0, jsx_runtime_1.jsx)(react_router_dom_1.BrowserRouter, { children: (0, jsx_runtime_1.jsx)(AuthContext_1.AuthProvider, { onLogout: onLogoutClick, onViewProfile: onViewProfileClick, onHome: onHomeClick, children: (0, jsx_runtime_1.jsx)(WebComponentLoader_1.default, { ...mergedProps }) }) }) }) }) }) }));
|
|
371267
371267
|
};
|
|
371268
371268
|
exports.TextJamEditor = TextJamEditor;
|
|
371269
371269
|
|
|
@@ -374752,8 +374752,6 @@ const useProject = ({ loadCache = true, identifier = null, projectData = null, t
|
|
|
374752
374752
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
374753
374753
|
}, [cacheKey, isEmbedded, isBrowserPreview, isLoading]);
|
|
374754
374754
|
(0, react_1.useEffect)(() => {
|
|
374755
|
-
if (!!templateId && !template?.data)
|
|
374756
|
-
return;
|
|
374757
374755
|
if (template?.isLoading)
|
|
374758
374756
|
return;
|
|
374759
374757
|
if (project?.identifier === identifier)
|
|
@@ -374769,6 +374767,8 @@ const useProject = ({ loadCache = true, identifier = null, projectData = null, t
|
|
|
374769
374767
|
dispatch((0, EditorSlice_1.setProject)(cachedProject));
|
|
374770
374768
|
return;
|
|
374771
374769
|
}
|
|
374770
|
+
if (!!templateId && template !== null && !template?.data)
|
|
374771
|
+
return;
|
|
374772
374772
|
// in case no identifier and no cached project, or provided identifier doesn't match cached project,
|
|
374773
374773
|
// create default project
|
|
374774
374774
|
const defaultProject = template?.data ?? (projectData?.project_type === ProjectTypes_1.ProjectType.WEB
|
|
@@ -375457,6 +375457,8 @@ exports.IndexedDb = {
|
|
|
375457
375457
|
await txDone(tx);
|
|
375458
375458
|
},
|
|
375459
375459
|
async setProject(projectKey, project) {
|
|
375460
|
+
if (!projectKey)
|
|
375461
|
+
return;
|
|
375460
375462
|
const db = await openDB();
|
|
375461
375463
|
const tx = db.transaction(STORE_PROJECTS, "readwrite");
|
|
375462
375464
|
tx.objectStore(STORE_PROJECTS).put({ ...project, savedAt: new Date().toISOString() }, projectKey);
|
|
@@ -375693,7 +375695,8 @@ const validateComponentName = (value, type) => {
|
|
|
375693
375695
|
}
|
|
375694
375696
|
const validExtensions = Object.values(ProjectTypes_1.ProjectFileExtension);
|
|
375695
375697
|
// Disallow unsupported file extensions
|
|
375696
|
-
if (extension &&
|
|
375698
|
+
if (extension &&
|
|
375699
|
+
!validExtensions?.includes(extension.toLowerCase())) {
|
|
375697
375700
|
return {
|
|
375698
375701
|
isValid: false,
|
|
375699
375702
|
error: NameError.UNSUPPORTED_EXTENSION,
|
|
@@ -375708,7 +375711,7 @@ exports.ErrorToMsgMap = {
|
|
|
375708
375711
|
[NameError.CHARACTERS_LIMIT]: `Name cannot be longer than ${exports.COMPONENT_NAME_LIMIT} characters.`,
|
|
375709
375712
|
[NameError.DOTFILE]: "Dotfiles are not allowed.",
|
|
375710
375713
|
[NameError.SLASH_SYMBOL]: "Name cannot contain slashes.",
|
|
375711
|
-
[NameError.INVALID_CHARACTERS]: "Use only A–Z, a–z, 0–9, dot
|
|
375714
|
+
[NameError.INVALID_CHARACTERS]: "Use only A–Z, a–z, 0–9, dot '.', underscore '_', hyphen '-', parentheses '()', and spaces.",
|
|
375712
375715
|
[NameError.TRAILING_DOT]: "Name cannot end with a dot.",
|
|
375713
375716
|
[NameError.WINDOWS_RESERVED]: "This name is reserved on Windows.",
|
|
375714
375717
|
[NameError.NO_EXTENSION]: "File must have an extension.",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gwchq-textjam",
|
|
3
3
|
"description": "Embeddable React editor used in Raspberry Pi text-based projects.",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.65",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/GirlsFirst/gwchq-textjam",
|
|
7
7
|
"author": "Girls Who Code HQ",
|