-
Notifications
You must be signed in to change notification settings - Fork 0
/
bbf-chosen.min.js
1 lines (1 loc) · 1.09 KB
/
bbf-chosen.min.js
1
!function(e,t){switch(!1){case!("function"==typeof define&&define.amd):define(["backbone-forms","chosen"],t);break;case"object"!=typeof exports:require("chosen-js"),t(require("backbone-forms"));break;default:t(e.Backbone.Form)}}(this,function(e){var t;t=e.editors.Select,e.editors.chosen=t.extend({events:{change:function(e){this.trigger("change",this)},"chosen:showing_dropdown":function(e){this.trigger("focus",this)},"chosen:hiding_dropdown":function(e){this.trigger("blur",this)}},initialize:function(e){var i;t.prototype.initialize.call(this,e),this.editorOptions=e.schema.editorOptions||{},i=this.$el,this.$el=Backbone.$("<div>"),this.el=this.$el[0],this.$el.html(i)},render:function(){return t.prototype.render.call(this),null!=this.editorOptions.width?this.renderChosen():setTimeout(this.renderChosen.bind(this),10),this},renderChosen:function(){this.$("select").chosen(this.editorOptions)},renderOptions:function(e){var t,i;t=this.$("select"),i=this._getOptionsHtml(e),t.html(i),this.setValue(this.value)},getValue:function(){return this.$("select").val()},setValue:function(e){this.$("select").val(e)}})});