File tree 1 file changed +14
-0
lines changed
1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 2
2
{ is-equal-to-object } = require \prelude-extension
3
3
{create-factory , DOM :{div , img , span }}: React = require \react
4
4
ReactSelectize = create-factory require \./ReactSelectize
5
+ { cancel-event } = require \./utils
5
6
6
7
module.exports = React .create-class do
7
8
@@ -27,6 +28,7 @@ module.exports = React.create-class do
27
28
on-blur : ((e ) !-> ) # :: # Event -> ()
28
29
on-focus : ((e ) !-> ) # :: Event -> ()
29
30
on-keyboard-selection-failed : ((which ) !-> ) # :: Int -> ()
31
+ on-paste : ((e ) !-> true ) # Event -> Boolean
30
32
# on-search-change :: String -> ()
31
33
# on-value-change :: Item -> ()
32
34
# open :: Boolean
@@ -188,6 +190,18 @@ module.exports = React.create-class do
188
190
189
191
on-focus : (e ) !~> @ props .on-focus {value , open , original-event : e }
190
192
193
+ # on-paste :: Event -> Boolean
194
+ on-paste :
195
+ | typeof @ props ? .value-from-paste == \undefined => @ props .on-paste
196
+ | _ => ({clipboard-data }: e ) ~>
197
+ value-from-paste = @ props .value-from-paste options , value , clipboard-data .get-data \text
198
+ if value-from-paste
199
+ do ~>
200
+ <~ on -value-change value-from-paste
201
+ <~ on -search-change " "
202
+ on -open-change false
203
+ cancel-event e
204
+
191
205
# STYLE
192
206
placeholder : @ props .placeholder
193
207
style : @ props .style
You can’t perform that action at this time.
0 commit comments