mirror of
https://github.com/penpot/penpot.git
synced 2026-08-07 21:38:48 +00:00
🐛 Fix json file name
This commit is contained in:
parent
1f22804f6a
commit
208b5da392
@ -318,7 +318,9 @@ export class ShortcutsPage extends BaseWebSocketPage {
|
||||
this.exportShortcuts(),
|
||||
]);
|
||||
|
||||
expect(download.suggestedFilename()).toBe("penpot-shortcuts.json");
|
||||
expect(download.suggestedFilename()).toMatch(
|
||||
/^penpot-shortcuts-Princesa_Leia-\d{4}-\d{2}-\d{2}\.json$/,
|
||||
);
|
||||
|
||||
const path = await download.path();
|
||||
const content = await readFile(path, "utf-8");
|
||||
|
||||
@ -424,11 +424,16 @@
|
||||
|
||||
on-export
|
||||
(mf/use-fn
|
||||
(mf/deps shortcuts-json has-custom-shortcuts)
|
||||
(mf/deps shortcuts-json has-custom-shortcuts (:fullname profile))
|
||||
(fn []
|
||||
(when has-custom-shortcuts
|
||||
(->> (wapi/create-blob shortcuts-json "application/json")
|
||||
(dom/trigger-download "penpot-shortcuts.json")))))
|
||||
(let [fullname (-> (or (:fullname profile) "user")
|
||||
(str/replace #"[^a-zA-Z0-9\-_ ]" "")
|
||||
(str/replace #"\s+" "_"))
|
||||
date (.slice (.toISOString (js/Date.)) 0 10)
|
||||
filename (str "penpot-shortcuts-" fullname "-" date ".json")]
|
||||
(->> (wapi/create-blob shortcuts-json "application/json")
|
||||
(dom/trigger-download filename))))))
|
||||
|
||||
on-file-selected
|
||||
(mf/use-fn
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user