Skip to content

Commit

Permalink
Merge pull request #610 from fhemberger/patch-1
Browse files Browse the repository at this point in the history
fix(shortcuts-settings): `settingsJSON` must be defined if note doesn't exist
  • Loading branch information
cheeaun authored Aug 4, 2024
2 parents 818f58b + 0febcac commit 4937c5f
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 4937c5f

Please sign in to comment.