From 0febcacb938f36946f80e34aadde0b391d67ea00 Mon Sep 17 00:00:00 2001 From: Frederic Hemberger Date: Sat, 3 Aug 2024 13:30:22 +0200 Subject: [PATCH] fix(shortcuts-settings): `settingsJSON` must be defined if note doesn't exist --- src/components/shortcuts-settings.jsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/shortcuts-settings.jsx b/src/components/shortcuts-settings.jsx index ad8aca57..de31c334 100644 --- a/src/components/shortcuts-settings.jsx +++ b/src/components/shortcuts-settings.jsx @@ -1055,16 +1055,16 @@ function ImportExport({ shortcuts, onClose }) { const { note = '' } = relationship; // const newNote = `${note}\n\n\n${shortcutsStr}`; let newNote = ''; + const settingsJSON = JSON.stringify({ + v: '1', // version + dt: Date.now(), // datetime stamp + data: shortcutsStr, // shortcuts settings string + }); if ( /(.*)<\/phanpy-shortcuts-settings>/.test( note, ) ) { - const settingsJSON = JSON.stringify({ - v: '1', // version - dt: Date.now(), // datetime stamp - data: shortcutsStr, // shortcuts settings string - }); newNote = note.replace( /(.*)<\/phanpy-shortcuts-settings>/, `${settingsJSON}`,