File tree Expand file tree Collapse file tree 4 files changed +15
-13
lines changed Expand file tree Collapse file tree 4 files changed +15
-13
lines changed Original file line number Diff line number Diff line change 22
22
[file-path data]
23
23
(let [document (pr-str (dissoc data :path :id :title ))]
24
24
(.writeFileSync fs file-path document " utf-8" )
25
- (js/Promise.resolve (serialize-document (select-keys data [:id ]) file-path))))
25
+ (-> (select-keys data [:id ])
26
+ (serialize-document file-path)
27
+ (js/Promise.resolve ))))
26
28
27
29
(defn- read!
28
30
[file-path]
Original file line number Diff line number Diff line change 43
43
(select-keys [:width :height ]))]
44
44
(if-not (-> db :window :focused )
45
45
db
46
- (reduce #(pan-by %1 (mat/div [(:width offset) (:height offset)] 2 ) %2 ) db (:document-tabs db)))))
46
+ (-> (:document-tabs db)
47
+ (reduce #(pan-by %1 (mat/div [(:width offset) (:height offset)] 2 ) %2 ) db)))))
47
48
48
49
(m/=> zoom-in-place [:-> App number? Vec2D App])
49
50
(defn zoom-in-place
Original file line number Diff line number Diff line change 98
98
([db]
99
99
(undo db 1 ))
100
100
([db n]
101
- (if (and (pos? n) (undos? (history db)))
102
- ( recur ( go-to db ( previous-position ( history db))) ( dec n))
103
- db )))
101
+ (if-not (and (pos? n) (undos? (history db)))
102
+ db
103
+ ( recur ( go-to db ( previous-position ( history db))) ( dec n)) )))
104
104
105
105
(m/=> redo [:function
106
106
[:-> App App]
109
109
([db]
110
110
(redo db 1 ))
111
111
([db n]
112
- (if (and (pos? n) (redos? (history db)))
113
- ( recur ( go-to db ( next-position ( history db))) ( dec n))
114
- db )))
112
+ (if-not (and (pos? n) (redos? (history db)))
113
+ db
114
+ ( recur ( go-to db ( next-position ( history db))) ( dec n)) )))
115
115
116
116
(m/=> accumulate [:-> History [:or fn? keyword?] [:vector HistoryState]])
117
117
(defn accumulate
177
177
db db]
178
178
(let [parent-id (:parent node)
179
179
parent (state (history db) parent-id)]
180
- (if parent
180
+ (if-not parent
181
+ db
181
182
(let [index (.indexOf (:children parent) (:id node))
182
183
new-index (dec (count (:children parent)))
183
184
children-path (path db :states parent-id :children )]
184
- (recur parent (update-in db children-path vec/move index new-index)))
185
- db))))
185
+ (recur parent (update-in db children-path vec/move index new-index)))))))
186
186
187
187
(def valid-elements? (m/validator [:map-of uuid? Element]))
188
188
Original file line number Diff line number Diff line change 50
50
(let [s (str/trim (str v))
51
51
n (js/parseFloat s 10 )
52
52
unit (match-unit s)]
53
- [(if (js/isNaN n) 0 n)
54
- unit]))
53
+ [(if (js/isNaN n) 0 n) unit]))
55
54
56
55
(m/=> ->px [:-> number? string? number?])
57
56
(defn ->px
You can’t perform that action at this time.
0 commit comments