Skip to content

Commit

Permalink
fix(shortcuts-settings): settingsJSON must be defined if note doesn…
Browse files Browse the repository at this point in the history
…'t exist
  • Loading branch information
fhemberger authored Aug 3, 2024
1 parent 818f58b commit 0febcac
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/components/shortcuts-settings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1055,16 +1055,16 @@ function ImportExport({ shortcuts, onClose }) {
const { note = '' } = relationship;
// const newNote = `${note}\n\n\n$<phanpy-shortcuts-settings>{shortcutsStr}</phanpy-shortcuts-settings>`;
let newNote = '';
const settingsJSON = JSON.stringify({
v: '1', // version
dt: Date.now(), // datetime stamp
data: shortcutsStr, // shortcuts settings string
});
if (
/<phanpy-shortcuts-settings>(.*)<\/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>(.*)<\/phanpy-shortcuts-settings>/,
`<phanpy-shortcuts-settings>${settingsJSON}</phanpy-shortcuts-settings>`,
Expand Down

0 comments on commit 0febcac

Please sign in to comment.