Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/cljs/orcpub/dnd/e5/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -3127,7 +3127,7 @@
(let [blob (js/Blob.
(clj->js [(str plugin)])
(clj->js {:type "text/plain;charset=utf-8"}))]
(js/saveAs blob (str name ".orcbrew"))
(js/saveAs blob (str name ".vaultbrew"))
{})))

(reg-event-fx
Expand All @@ -3136,7 +3136,7 @@
(let [blob (js/Blob.
(clj->js [(str @(subscribe [::e5/plugins]))])
(clj->js {:type "text/plain;charset=utf-8"}))]
(js/saveAs blob (str "all-content.orcbrew"))
(js/saveAs blob (str "all-content.vaultbrew"))
{})))

(reg-event-fx
Expand All @@ -3145,15 +3145,15 @@
(let [blob (js/Blob.
(clj->js [(with-out-str (pprint/pprint plugin))])
(clj->js {:type "text/plain;charset=utf-8"}))]
(js/saveAs blob (str name ".orcbrew"))
(js/saveAs blob (str name ".vaultbrew"))
{})))
(reg-event-fx
::e5/export-all-plugins-pretty-print
(fn [_ _]
(let [blob (js/Blob.
(clj->js [(with-out-str (pprint/pprint @(subscribe [::e5/plugins])))])
(clj->js {:type "text/plain;charset=utf-8"}))]
(js/saveAs blob (str "all-content.orcbrew"))
(js/saveAs blob (str "all-content.vaultbrew"))
{})))

(reg-event-fx
Expand Down Expand Up @@ -3197,7 +3197,7 @@
(spec/explain-data ::e5/plugins plugin))
(prn "INVALID PLUGIN FILE"
(spec/explain-data ::e5/plugin plugin))
{:dispatch [:show-error-message "Invalid .orcbrew file"]})))))
{:dispatch [:show-error-message "Invalid .orcbrew/.vaultbrew file"]})))))

(reg-event-db
::spells/set-spell
Expand Down
28 changes: 18 additions & 10 deletions src/cljs/orcpub/dnd/e5/views.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -6982,15 +6982,23 @@
(defn import-file [e]
(let [reader (js/FileReader.)
file (.. e -target -files (item 0))
filename (.-name file)
nm (first (s/split filename #".orcbrew"))]
(.addEventListener
reader
"load"
(fn [e]
(let [text (.. e -target -result)]
(dispatch [::e5/import-plugin nm text]))))
(.readAsText reader file)))
filename (.-name file)]
(if (s/includes? filename ".orcbrew") (let [nm (first (s/split filename (or #".orcbrew")))]
(.addEventListener
reader
"load"
(fn [e]
(let [text (.. e -target -result)]
(dispatch [::e5/import-plugin nm text]))))
(.readAsText reader file))
(let [nm (first (s/split filename (or #".vaultbrew")))]
(.addEventListener
reader
"load"
(fn [e]
(let [text (.. e -target -result)]
(dispatch [::e5/import-plugin nm text]))))
(.readAsText reader file)))))

(defn capitalize-words
[s]
Expand Down Expand Up @@ -7253,7 +7261,7 @@
[:div.p-20.bg-lighter.main-text-color.m-b-10.m-l-10.m-r-10.b-rad-5
[:div.f-w-b.f-s-24.m-b-5 "Import Option Source"]
[:input {:type "file"
:accept ".orcbrew"
:accept [".orcbrew", ".vaultbrew"]
:on-change import-file}]]
[my-content]]])

Expand Down