mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-08 17:16:25 +01:00
fix(shortcuts-settings): settingsJSON
must be defined if note doesn't exist
This commit is contained in:
parent
818f58b460
commit
0febcacb93
1 changed files with 5 additions and 5 deletions
|
@ -1055,16 +1055,16 @@ function ImportExport({ shortcuts, onClose }) {
|
||||||
const { note = '' } = relationship;
|
const { note = '' } = relationship;
|
||||||
// const newNote = `${note}\n\n\n$<phanpy-shortcuts-settings>{shortcutsStr}</phanpy-shortcuts-settings>`;
|
// const newNote = `${note}\n\n\n$<phanpy-shortcuts-settings>{shortcutsStr}</phanpy-shortcuts-settings>`;
|
||||||
let newNote = '';
|
let newNote = '';
|
||||||
|
const settingsJSON = JSON.stringify({
|
||||||
|
v: '1', // version
|
||||||
|
dt: Date.now(), // datetime stamp
|
||||||
|
data: shortcutsStr, // shortcuts settings string
|
||||||
|
});
|
||||||
if (
|
if (
|
||||||
/<phanpy-shortcuts-settings>(.*)<\/phanpy-shortcuts-settings>/.test(
|
/<phanpy-shortcuts-settings>(.*)<\/phanpy-shortcuts-settings>/.test(
|
||||||
note,
|
note,
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
const settingsJSON = JSON.stringify({
|
|
||||||
v: '1', // version
|
|
||||||
dt: Date.now(), // datetime stamp
|
|
||||||
data: shortcutsStr, // shortcuts settings string
|
|
||||||
});
|
|
||||||
newNote = note.replace(
|
newNote = note.replace(
|
||||||
/<phanpy-shortcuts-settings>(.*)<\/phanpy-shortcuts-settings>/,
|
/<phanpy-shortcuts-settings>(.*)<\/phanpy-shortcuts-settings>/,
|
||||||
`<phanpy-shortcuts-settings>${settingsJSON}</phanpy-shortcuts-settings>`,
|
`<phanpy-shortcuts-settings>${settingsJSON}</phanpy-shortcuts-settings>`,
|
||||||
|
|
Loading…
Reference in a new issue