1 /**
  2  * custom overlay  for kissy editor
  3  * @author yiminghe@gmail.com
  4  */
  5 KISSY.add("editor/plugin/overlay/index", function (S, Editor, Overlay, focusFix) {
  6     var Overlay4E = Overlay.extend({
  7         bindUI:function () {
  8             focusFix.init(this);
  9         }
 10     }, {
 11         ATTRS:{
 12             prefixCls:{
 13                 value:"ks-editor-"
 14             },
 15             zIndex:{
 16                 value:Editor.baseZIndex(Editor.zIndexManager.OVERLAY)
 17             }
 18         }
 19     });
 20 
 21     Overlay4E.Dialog = Overlay.Dialog.extend({
 22         bindUI:function () {
 23             focusFix.init(this);
 24         },
 25         show:function () {
 26             var self = this;
 27             //在 show 之前调用
 28             self.center();
 29             var y = self.get("y");
 30             //居中有点偏下
 31             if (y - S.DOM.scrollTop() > 200) {
 32                 y = S.DOM.scrollTop() + 200;
 33                 self.set("y", y);
 34             }
 35             Overlay4E.prototype.show.call(self);
 36         }
 37     }, {
 38         ATTRS:{
 39             elAttrs:{
 40                 value:{
 41                     hideFocus:'hideFocus'
 42                 }
 43             },
 44             prefixCls:{
 45                 value:"ks-editor-"
 46             },
 47             zIndex:{
 48                 value:Editor.baseZIndex(Editor.zIndexManager.OVERLAY)
 49             },
 50             draggable:{
 51                 value:true
 52             },
 53             constrain:{
 54                 value:true
 55             },
 56             aria:{
 57                 value:true
 58             }
 59         }
 60     });
 61 
 62     return Overlay4E
 63 }, {
 64     requires:["editor", 'overlay', '../focusFix/', 'dd']
 65 });