From 5c5c1781b445a6d3f05a1c4d29b27f8cd672d928 Mon Sep 17 00:00:00 2001 From: Lars Date: Wed, 23 Oct 2024 13:31:17 +0200 Subject: [PATCH 1/3] feat(editor): show user a warning in test environments that content might disappear --- packages/editor/src/i18n/strings/de/edit.ts | 2 ++ packages/editor/src/i18n/strings/en/edit.ts | 2 ++ packages/editor/src/package/config.ts | 1 + packages/editor/src/package/editor.tsx | 11 +++++++++++ 4 files changed, 16 insertions(+) diff --git a/packages/editor/src/i18n/strings/de/edit.ts b/packages/editor/src/i18n/strings/de/edit.ts index 8e185310a6..879f626aa8 100644 --- a/packages/editor/src/i18n/strings/de/edit.ts +++ b/packages/editor/src/i18n/strings/de/edit.ts @@ -5,6 +5,8 @@ export const editStrings = { confirmRouteChange: 'Willst du wirklich die Seite verlassen ohne zu speichern?', noChangesWarning: 'Bisher hast du nichts geändert', + savedContentMightDisappearWarning: + '⚠️ Dies ist eine Testumgebung. Bitte erstell hier noch keine Inhalte, die du langfristig behalten willst.', addPluginsModal: { searchInputPlaceholder: 'Suche...', basicPluginsTitle: 'Inhalte', diff --git a/packages/editor/src/i18n/strings/en/edit.ts b/packages/editor/src/i18n/strings/en/edit.ts index 43b007e870..3c25deed67 100644 --- a/packages/editor/src/i18n/strings/en/edit.ts +++ b/packages/editor/src/i18n/strings/en/edit.ts @@ -4,6 +4,8 @@ export const editStrings = { lang: 'en', confirmRouteChange: 'Are you sure you want to leave without saving?', noChangesWarning: 'Nothing changed so there is no need to save yet', + savedContentMightDisappearWarning: + '⚠️ This is a test environment. Please do not create content that you want to keep long term here.', addPluginsModal: { searchInputPlaceholder: 'Search...', basicPluginsTitle: 'Content Elements', diff --git a/packages/editor/src/package/config.ts b/packages/editor/src/package/config.ts index 71358e508d..73d74f0c6a 100644 --- a/packages/editor/src/package/config.ts +++ b/packages/editor/src/package/config.ts @@ -29,4 +29,5 @@ export const defaultSerloEditorProps = { plugins: defaultPlugins, onChange: undefined, language: 'de' as SupportedLanguage, + isProductionEnvironment: false, } diff --git a/packages/editor/src/package/editor.tsx b/packages/editor/src/package/editor.tsx index 1b79cb73fc..a7c1141e3b 100644 --- a/packages/editor/src/package/editor.tsx +++ b/packages/editor/src/package/editor.tsx @@ -31,6 +31,7 @@ export interface SerloEditorProps { onChange?: (state: StorageFormat) => void language?: SupportedLanguage editorVariant: EditorVariant + isProductionEnvironment?: boolean _testingSecret?: string | null _ltik?: string } @@ -43,6 +44,7 @@ export function SerloEditor(props: SerloEditorProps) { onChange, language, plugins, + isProductionEnvironment, _testingSecret, _ltik, } = { @@ -72,6 +74,7 @@ export function SerloEditor(props: SerloEditorProps) { + {!isProductionEnvironment ? renderTestEnvironmentWarning() : null} + {editStrings.savedContentMightDisappearWarning} + + ) + } } From 15443c8438501ef66393533627a33c55ffbc7bde Mon Sep 17 00:00:00 2001 From: LarsTheGlidingSquirrel <59921805+LarsTheGlidingSquirrel@users.noreply.github.com> Date: Wed, 23 Oct 2024 15:43:23 +0200 Subject: [PATCH 2/3] Update packages/editor/src/i18n/strings/de/edit.ts Co-authored-by: Botho <1258870+elbotho@users.noreply.github.com> --- packages/editor/src/i18n/strings/de/edit.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/editor/src/i18n/strings/de/edit.ts b/packages/editor/src/i18n/strings/de/edit.ts index 879f626aa8..48ddbb86c0 100644 --- a/packages/editor/src/i18n/strings/de/edit.ts +++ b/packages/editor/src/i18n/strings/de/edit.ts @@ -6,7 +6,7 @@ export const editStrings = { 'Willst du wirklich die Seite verlassen ohne zu speichern?', noChangesWarning: 'Bisher hast du nichts geändert', savedContentMightDisappearWarning: - '⚠️ Dies ist eine Testumgebung. Bitte erstell hier noch keine Inhalte, die du langfristig behalten willst.', + '⚠️ Dies ist eine Testumgebung. Bitte erstelle hier noch keine Inhalte, die du langfristig behalten willst.', addPluginsModal: { searchInputPlaceholder: 'Suche...', basicPluginsTitle: 'Inhalte', From 1be914f1a37ee9037ea52cd712786f881893e6f5 Mon Sep 17 00:00:00 2001 From: LarsTheGlidingSquirrel <59921805+LarsTheGlidingSquirrel@users.noreply.github.com> Date: Wed, 23 Oct 2024 15:44:47 +0200 Subject: [PATCH 3/3] refactor(editor): tiny change Co-authored-by: Botho <1258870+elbotho@users.noreply.github.com> --- packages/editor/src/package/editor.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/editor/src/package/editor.tsx b/packages/editor/src/package/editor.tsx index 834a2cc0ac..8bead46cfc 100644 --- a/packages/editor/src/package/editor.tsx +++ b/packages/editor/src/package/editor.tsx @@ -76,7 +76,7 @@ export function SerloEditor(props: SerloEditorProps) { - {!isProductionEnvironment ? renderTestEnvironmentWarning() : null} + {isProductionEnvironment ? null : renderTestEnvironmentWarning()}