File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 329
329
330
330
if ( this . value . length === 0 ) {
331
331
if ( selected_token ) {
332
- delete_token ( $ ( selected_token ) ) ;
333
- hidden_input . change ( ) ;
332
+ var deleted = delete_token ( $ ( selected_token ) ) ;
333
+ if ( deleted ) {
334
+ hidden_input . change ( ) ;
335
+ }
334
336
} else if ( previous_token . length ) {
335
337
select_token ( $ ( previous_token . get ( 0 ) ) ) ;
336
338
}
743
745
function delete_token ( token ) {
744
746
// Remove the id from the saved list
745
747
var token_data = $ . data ( token . get ( 0 ) , "tokeninput" ) ;
748
+
749
+ if ( token_data . readonly ) { return false ; }
750
+
746
751
var callback = $ ( input ) . data ( "settings" ) . onDelete ;
747
752
748
753
var index = token . prevAll ( ) . length ;
778
783
if ( $ . isFunction ( callback ) ) {
779
784
callback . call ( hidden_input , token_data ) ;
780
785
}
786
+
787
+ return true ;
781
788
}
782
789
783
790
// Update the hidden input box value
You can’t perform that action at this time.
0 commit comments