diff --git a/lib/editor/atto/plugins/image/yui/build/moodle-atto_image-button/moodle-atto_image-button-debug.js b/lib/editor/atto/plugins/image/yui/build/moodle-atto_image-button/moodle-atto_image-button-debug.js index 6ae8a061c21..e3c7be8973c 100644 --- a/lib/editor/atto/plugins/image/yui/build/moodle-atto_image-button/moodle-atto_image-button-debug.js +++ b/lib/editor/atto/plugins/image/yui/build/moodle-atto_image-button/moodle-atto_image-button-debug.js @@ -280,16 +280,15 @@ Y.namespace('M.atto_image').Button = Y.Base.create('button', Y.M.editor_atto.Edi * * @method _handleDragDrop * @param {EventFacade} e - * @return {boolean} false if we handled the event, else true. * @private */ _handleDragDrop: function(e) { if (!e._event || !e._event.dataTransfer) { // Drop not fully supported in this browser. - return true; + return; } - return this._handlePasteOrDropHelper(e, e._event.dataTransfer); + this._handlePasteOrDropHelper(e, e._event.dataTransfer); }, /** @@ -335,13 +334,7 @@ Y.namespace('M.atto_image').Button = Y.Base.create('button', Y.M.editor_atto.Edi } if (didUpload) { - // We handled this. e.preventDefault(); - e.stopPropagation(); - return false; - } else { - // Let someone else try to handle it. - return true; } }, diff --git a/lib/editor/atto/plugins/image/yui/build/moodle-atto_image-button/moodle-atto_image-button-min.js b/lib/editor/atto/plugins/image/yui/build/moodle-atto_image-button/moodle-atto_image-button-min.js index bc6669c2089..b4b50989571 100644 --- a/lib/editor/atto/plugins/image/yui/build/moodle-atto_image-button/moodle-atto_image-button-min.js +++ b/lib/editor/atto/plugins/image/yui/build/moodle-atto_image-button/moodle-atto_image-button-min.js @@ -1,3 +1,3 @@ -YUI.add("moodle-atto_image-button",function(c,e){var u={RESPONSIVE:"img-fluid",INPUTALIGNMENT:"atto_image_alignment",INPUTALT:"atto_image_altentry",INPUTHEIGHT:"atto_image_heightentry",INPUTSUBMIT:"atto_image_urlentrysubmit",INPUTURL:"atto_image_urlentry",INPUTSIZE:"atto_image_size",INPUTWIDTH:"atto_image_widthentry",IMAGEALTWARNING:"atto_image_altwarning",IMAGEURLWARNING:"atto_image_urlwarning",IMAGEBROWSER:"openimagebrowser",IMAGEPRESENTATION:"atto_image_presentation",INPUTCONSTRAIN:"atto_image_constrain",INPUTCUSTOMSTYLE:"atto_image_customstyle",IMAGEPREVIEW:"atto_image_preview",IMAGEPREVIEWBOX:"atto_image_preview_box",ALIGNSETTINGS:"atto_image_button"},n={URL:"urlentry",ALT:"altentry"},t={INPUTURL:"."+u.INPUTURL},s=[{name:"verticalAlign",str:"alignment_top",value:"text-top",margin:"0 0.5em"},{name:"verticalAlign",str:"alignment_middle",value:"middle",margin:"0 0.5em"},{name:"verticalAlign",str:"alignment_bottom",value:"text-bottom",margin:"0 0.5em",isDefault:!0},{name:"float",str:"alignment_left",value:"left",margin:"0 0.5em 0 0"},{name:"float",str:"alignment_right",value:"right",margin:"0 0 0 0.5em"}],o=160,l=160,I=/\d+%/,_="atto_image",p='{{alt}}';c.namespace("M.atto_image").Button=c.Base.create("button",c.M.editor_atto.EditorPlugin,[],{_currentSelection:null,_selectedImage:null,_form:null,_rawImageDimensions:null,initializer:function(){this.addButton({icon:"e/insert_edit_image",callback:this._displayDialogue,tags:"img",tagMatchRequiresAll:!1}),this.editor.delegate("dblclick",this._displayDialogue,"img",this),this.editor.delegate("click",this._handleClick,"img",this),this.editor.on("paste",this._handlePaste,this),this.editor.on("drop",this._handleDragDrop,this),this.editor.on("dragover",function(e){e.preventDefault()},this),this.editor.on("dragenter",function(e){e.preventDefault()},this)},_handleDragDrop:function(e){return!e._event||!e._event.dataTransfer||this._handlePasteOrDropHelper(e,e._event.dataTransfer)},_handlePaste:function(e){return!e._event||!e._event.clipboardData||this._handlePasteOrDropHelper(e,e._event.clipboardData)},_handlePasteOrDropHelper:function(e,t){var i,n,a=t.items,s=!1;for(i=0;i{{#if showFilepicker}}
{{else}}
{{/if}}
0 / 125
x

'),t=this.get("host").canShowFilepicker("image"),i=c.Node.create(e({elementid:this.get("host").get("elementid"),CSS:u,FORMNAMES:n,component:_,showFilepicker:t,alignments:s}));return this._form=i,this._applyImageProperties(this._form),this._form.one("."+u.INPUTURL).on("blur",this._urlChanged,this),this._form.one("."+u.INPUTURL).on("change",this._hasErrorUrlField,this),this._form.one("."+u.IMAGEPRESENTATION).on("change",this._hasErrorAltField,this),this._form.one("."+u.INPUTALT).on("blur",this._hasErrorAltField,this),this._form.one("."+u.INPUTWIDTH).on("blur",this._autoAdjustSize,this),this._form.one("."+u.INPUTHEIGHT).on("blur",this._autoAdjustSize,this,!0),this._form.one("."+u.INPUTCONSTRAIN).on("change",function(e){e.target.get("checked")&&this._autoAdjustSize(e)},this),this._form.one("."+u.INPUTSUBMIT).on("click",this._setImage,this),t&&this._form.one("."+u.IMAGEBROWSER).on("click",function(){this.get("host").showFilepicker("image",this._filepickerCallback,this)},this),this._form.one("."+u.INPUTALT).on("keyup",this._handleKeyup,this),i},_autoAdjustSize:function(e,t){var i,n,a,s,o,l,r,g,h,d,m;t=t||!1,i=this._form.one("."+u.INPUTWIDTH),n="width",a=this._form.one("."+u.INPUTHEIGHT),s="height",o=this._form.one("."+u.INPUTCONSTRAIN),l=i.get("value"),r=a.get("value"),g=this._form.one("."+u.IMAGEPREVIEW),this._rawImageDimensions&&(""===l&&(l=this._rawImageDimensions[n],i.set("value",l),l=i.get("value")),g.setStyles({width:null,height:null}),o.get("checked")?(t&&(m=i,i=a,a=m,m=n,n=s,s=m,m=l,l=r,r=m),l.match(I)?(r=l,h=parseInt(l,10),d=this._rawImageDimensions.width/100*h,g.setStyle("width",d),d=this._rawImageDimensions.height/100*h,g.setStyle("height",d)):(r=Math.round(l/this._rawImageDimensions[n]*this._rawImageDimensions[s]),t?g.setStyles({width:r,height:l}):g.setStyles({width:l,height:r})),a.set("value",r)):(l.match(I)?(h=parseInt(l,10),d=this._rawImageDimensions.width/100*h,g.setStyle("width",d+"px")):g.setStyle("width",l+"px"),r.match(I)?(h=parseInt(r,10),d=this._rawImageDimensions.height/100*h,g.setStyle("height",d+"px")):g.setStyle("height",r+"px")))},_filepickerCallback:function(e){""!==e.url&&(this._form.one("."+u.INPUTURL).set("value",e.url),this._form.one("."+u.INPUTWIDTH).set("value",""),this._form.one("."+u.INPUTHEIGHT).set("value",""),this._loadPreviewImage(e.url))},_applyImageProperties:function(t){var e=this._getSelectedImageProperties(),i=t.one("."+u.IMAGEPREVIEW);if(!1===e)return i.setStyle("display","none"),void s.some(function(e){return!!e.isDefault&&(t.one("."+u.INPUTALIGNMENT).set("value", -e.value),!0)},this);e.align&&t.one("."+u.INPUTALIGNMENT).set("value",e.align),e.customstyle&&t.one("."+u.INPUTCUSTOMSTYLE).set("value",e.customstyle),e.width&&t.one("."+u.INPUTWIDTH).set("value",e.width),e.height&&t.one("."+u.INPUTHEIGHT).set("value",e.height),e.alt&&t.one("."+u.INPUTALT).set("value",e.alt),e.src&&(t.one("."+u.INPUTURL).set("value",e.src),this._loadPreviewImage(e.src)),e.presentation&&t.one("."+u.IMAGEPRESENTATION).set("checked","checked"),this._autoAdjustSize()},_getSelectedImageProperties:function(){var e,t,i,n,a={src:null,alt:null,width:null,height:null,align:"",presentation:!1},s=this.get("host").getSelectedNodes();return(s=s&&s.filter("img"))&&s.size()?(n=this._removeLegacyAlignment(s.item(0)),i=(this._selectedImage=n).getAttribute("style"),a.customstyle=i,(e=n.getAttribute("width")).match(I)||(e=parseInt(e,10)),(t=n.getAttribute("height")).match(I)||(t=parseInt(t,10)),0!==e&&(a.width=e),0!==t&&(a.height=t),this._getAlignmentPropeties(n,a),a.src=n.getAttribute("src"),a.alt=n.getAttribute("alt")||"",a.presentation="presentation"===n.get("role"),a):(this._selectedImage=null,!1)},_getAlignmentPropeties:function(i,n){var a;!s.some(function(e){var t=this._getAlignmentClass(e.value);return i.hasClass(t)?(n.align=e.value,!0):(e.isDefault&&(a=e.value),!1)},this)&&a&&(n.align=a)},_urlChanged:function(){var e=this._form.one("."+u.INPUTURL);""!==e.get("value")&&this._loadPreviewImage(e.get("value"))},_setImage:function(e){var t,i=this._form,n=i.one("."+u.INPUTURL).get("value"),a=i.one("."+u.INPUTALT).get("value"),s=i.one("."+u.INPUTWIDTH).get("value"),o=i.one("."+u.INPUTHEIGHT).get("value"),l=this._getAlignmentClass(i.one("."+u.INPUTALIGNMENT).get("value")),r=i.one("."+u.IMAGEPRESENTATION).get("checked"),g=i.one("."+u.INPUTCONSTRAIN).get("checked"),h=i.one("."+u.INPUTCUSTOMSTYLE).get("value"),d=[],m=this.get("host");if(e.preventDefault(),!this._updateWarning()){if(m.focus(),""!==n){if(this._selectedImage?m.setSelection(m.getSelectionFromNode(this._selectedImage)):m.setSelection(this._currentSelection),g&&d.push(u.RESPONSIVE),d.push(l),!s.match(I)&&isNaN(parseInt(s,10)))return void i.one("."+u.INPUTWIDTH).focus();if(!o.match(I)&&isNaN(parseInt(o,10)))return void i.one("."+u.INPUTHEIGHT).focus();t=c.Handlebars.compile(p)({url:n,alt:a,width:s,height:o,presentation:r,customstyle:h,classlist:d.join(" ")}),this.get("host").insertContentAtFocusPoint(t),this.markUpdated()}this.getDialogue({focusAfterHide:null}).hide()}},_removeLegacyAlignment:function(i){return i.getStyle("margin")&&s.some(function(e){if(i.getStyle(e.name)!==e.value)return!1;var t=c.Node.create("
");return t.setStyle("margin",e.margin),i.getStyle("margin")===t.getStyle("margin")&&(i.addClass(this._getAlignmentClass(e.value)),i.setStyle(e.name,null),i.setStyle("margin",null),!0)},this),i},_getAlignmentClass:function(e){return u.ALIGNSETTINGS+"_"+e},_toggleVisibility:function(e,t){var i=this._form,n=i.all(e);n.setStyle("display",t?"block":"none")},_toggleAriaInvalid:function(e,t){var i=this._form;e.forEach(function(e){i.all(e).setAttribute("aria-invalid",t)})},_hasErrorUrlField:function(){var e=this._form,t=e.one("."+u.INPUTURL).get("value"),i=""===t;return this._toggleVisibility("."+u.IMAGEURLWARNING,i),this._toggleAriaInvalid(["."+u.INPUTURL],i),i},_hasErrorAltField:function(){var e=this._form,t=e.one("."+u.INPUTALT).get("value"),i=e.one("."+u.IMAGEPRESENTATION).get("checked"),n=""===t&&!i;return this._toggleVisibility("."+u.IMAGEALTWARNING,n),this._toggleAriaInvalid(["."+u.INPUTALT,"."+u.IMAGEPRESENTATION],n),n},_updateWarning:function(){var e=this._hasErrorUrlField(),t=this._hasErrorAltField(),i=e||t;return this.getDialogue().centerDialogue(),i},_handleKeyup:function(){var e=this._form,t=e.one("."+u.INPUTALT).get("value").length;e.one("#currentcount").setHTML(t)}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]}); \ No newline at end of file +YUI.add("moodle-atto_image-button",function(c,e){var u={RESPONSIVE:"img-fluid",INPUTALIGNMENT:"atto_image_alignment",INPUTALT:"atto_image_altentry",INPUTHEIGHT:"atto_image_heightentry",INPUTSUBMIT:"atto_image_urlentrysubmit",INPUTURL:"atto_image_urlentry",INPUTSIZE:"atto_image_size",INPUTWIDTH:"atto_image_widthentry",IMAGEALTWARNING:"atto_image_altwarning",IMAGEURLWARNING:"atto_image_urlwarning",IMAGEBROWSER:"openimagebrowser",IMAGEPRESENTATION:"atto_image_presentation",INPUTCONSTRAIN:"atto_image_constrain",INPUTCUSTOMSTYLE:"atto_image_customstyle",IMAGEPREVIEW:"atto_image_preview",IMAGEPREVIEWBOX:"atto_image_preview_box",ALIGNSETTINGS:"atto_image_button"},n={URL:"urlentry",ALT:"altentry"},t={INPUTURL:"."+u.INPUTURL},s=[{name:"verticalAlign",str:"alignment_top",value:"text-top",margin:"0 0.5em"},{name:"verticalAlign",str:"alignment_middle",value:"middle",margin:"0 0.5em"},{name:"verticalAlign",str:"alignment_bottom",value:"text-bottom",margin:"0 0.5em",isDefault:!0},{name:"float",str:"alignment_left",value:"left",margin:"0 0.5em 0 0"},{name:"float",str:"alignment_right",value:"right",margin:"0 0 0 0.5em"}],o=160,l=160,I=/\d+%/,_="atto_image",p='{{alt}}';c.namespace("M.atto_image").Button=c.Base.create("button",c.M.editor_atto.EditorPlugin,[],{_currentSelection:null,_selectedImage:null,_form:null,_rawImageDimensions:null,initializer:function(){this.addButton({icon:"e/insert_edit_image",callback:this._displayDialogue,tags:"img",tagMatchRequiresAll:!1}),this.editor.delegate("dblclick",this._displayDialogue,"img",this),this.editor.delegate("click",this._handleClick,"img",this),this.editor.on("paste",this._handlePaste,this),this.editor.on("drop",this._handleDragDrop,this),this.editor.on("dragover",function(e){e.preventDefault()},this),this.editor.on("dragenter",function(e){e.preventDefault()},this)},_handleDragDrop:function(e){e._event&&e._event.dataTransfer&&this._handlePasteOrDropHelper(e,e._event.dataTransfer)},_handlePaste:function(e){return!e._event||!e._event.clipboardData||this._handlePasteOrDropHelper(e,e._event.clipboardData)},_handlePasteOrDropHelper:function(e,t){var i,n,a=t.items,s=!1;for(i=0;i{{#if showFilepicker}}
{{else}}
{{/if}}
0 / 125
x

'),t=this.get("host").canShowFilepicker("image"),i=c.Node.create(e({elementid:this.get("host").get("elementid"),CSS:u,FORMNAMES:n,component:_,showFilepicker:t,alignments:s}));return this._form=i,this._applyImageProperties(this._form),this._form.one("."+u.INPUTURL).on("blur",this._urlChanged,this),this._form.one("."+u.INPUTURL).on("change",this._hasErrorUrlField,this),this._form.one("."+u.IMAGEPRESENTATION).on("change",this._hasErrorAltField,this),this._form.one("."+u.INPUTALT).on("blur",this._hasErrorAltField,this),this._form.one("."+u.INPUTWIDTH).on("blur",this._autoAdjustSize,this),this._form.one("."+u.INPUTHEIGHT).on("blur",this._autoAdjustSize,this,!0),this._form.one("."+u.INPUTCONSTRAIN).on("change",function(e){e.target.get("checked")&&this._autoAdjustSize(e)},this),this._form.one("."+u.INPUTSUBMIT).on("click",this._setImage,this),t&&this._form.one("."+u.IMAGEBROWSER).on("click",function(){this.get("host").showFilepicker("image",this._filepickerCallback,this)},this),this._form.one("."+u.INPUTALT).on("keyup",this._handleKeyup,this),i},_autoAdjustSize:function(e,t){var i,n,a,s,o,l,r,g,h,d,m;t=t||!1,i=this._form.one("."+u.INPUTWIDTH),n="width",a=this._form.one("."+u.INPUTHEIGHT),s="height",o=this._form.one("."+u.INPUTCONSTRAIN),l=i.get("value"),r=a.get("value"),g=this._form.one("."+u.IMAGEPREVIEW),this._rawImageDimensions&&(""===l&&(l=this._rawImageDimensions[n],i.set("value",l),l=i.get("value")),g.setStyles({width:null,height:null}),o.get("checked")?(t&&(m=i,i=a,a=m,m=n,n=s,s=m,m=l,l=r,r=m),l.match(I)?(r=l,h=parseInt(l,10),d=this._rawImageDimensions.width/100*h,g.setStyle("width",d),d=this._rawImageDimensions.height/100*h,g.setStyle("height",d)):(r=Math.round(l/this._rawImageDimensions[n]*this._rawImageDimensions[s]),t?g.setStyles({width:r,height:l}):g.setStyles({width:l,height:r})),a.set("value",r)):(l.match(I)?(h=parseInt(l,10),d=this._rawImageDimensions.width/100*h,g.setStyle("width",d+"px")):g.setStyle("width",l+"px"),r.match(I)?(h=parseInt(r,10),d=this._rawImageDimensions.height/100*h,g.setStyle("height",d+"px")):g.setStyle("height",r+"px")))},_filepickerCallback:function(e){""!==e.url&&(this._form.one("."+u.INPUTURL).set("value",e.url),this._form.one("."+u.INPUTWIDTH).set("value",""),this._form.one("."+u.INPUTHEIGHT).set("value",""),this._loadPreviewImage(e.url))},_applyImageProperties:function(t){var e=this._getSelectedImageProperties(),i=t.one("."+u.IMAGEPREVIEW);if(!1===e)return i.setStyle("display","none"),void s.some(function(e){return!!e.isDefault&&(t.one("."+u.INPUTALIGNMENT).set("value",e.value),!0)},this) +;e.align&&t.one("."+u.INPUTALIGNMENT).set("value",e.align),e.customstyle&&t.one("."+u.INPUTCUSTOMSTYLE).set("value",e.customstyle),e.width&&t.one("."+u.INPUTWIDTH).set("value",e.width),e.height&&t.one("."+u.INPUTHEIGHT).set("value",e.height),e.alt&&t.one("."+u.INPUTALT).set("value",e.alt),e.src&&(t.one("."+u.INPUTURL).set("value",e.src),this._loadPreviewImage(e.src)),e.presentation&&t.one("."+u.IMAGEPRESENTATION).set("checked","checked"),this._autoAdjustSize()},_getSelectedImageProperties:function(){var e,t,i,n,a={src:null,alt:null,width:null,height:null,align:"",presentation:!1},s=this.get("host").getSelectedNodes();return(s=s&&s.filter("img"))&&s.size()?(n=this._removeLegacyAlignment(s.item(0)),i=(this._selectedImage=n).getAttribute("style"),a.customstyle=i,(e=n.getAttribute("width")).match(I)||(e=parseInt(e,10)),(t=n.getAttribute("height")).match(I)||(t=parseInt(t,10)),0!==e&&(a.width=e),0!==t&&(a.height=t),this._getAlignmentPropeties(n,a),a.src=n.getAttribute("src"),a.alt=n.getAttribute("alt")||"",a.presentation="presentation"===n.get("role"),a):(this._selectedImage=null,!1)},_getAlignmentPropeties:function(i,n){var a;!s.some(function(e){var t=this._getAlignmentClass(e.value);return i.hasClass(t)?(n.align=e.value,!0):(e.isDefault&&(a=e.value),!1)},this)&&a&&(n.align=a)},_urlChanged:function(){var e=this._form.one("."+u.INPUTURL);""!==e.get("value")&&this._loadPreviewImage(e.get("value"))},_setImage:function(e){var t,i=this._form,n=i.one("."+u.INPUTURL).get("value"),a=i.one("."+u.INPUTALT).get("value"),s=i.one("."+u.INPUTWIDTH).get("value"),o=i.one("."+u.INPUTHEIGHT).get("value"),l=this._getAlignmentClass(i.one("."+u.INPUTALIGNMENT).get("value")),r=i.one("."+u.IMAGEPRESENTATION).get("checked"),g=i.one("."+u.INPUTCONSTRAIN).get("checked"),h=i.one("."+u.INPUTCUSTOMSTYLE).get("value"),d=[],m=this.get("host");if(e.preventDefault(),!this._updateWarning()){if(m.focus(),""!==n){if(this._selectedImage?m.setSelection(m.getSelectionFromNode(this._selectedImage)):m.setSelection(this._currentSelection),g&&d.push(u.RESPONSIVE),d.push(l),!s.match(I)&&isNaN(parseInt(s,10)))return void i.one("."+u.INPUTWIDTH).focus();if(!o.match(I)&&isNaN(parseInt(o,10)))return void i.one("."+u.INPUTHEIGHT).focus();t=c.Handlebars.compile(p)({url:n,alt:a,width:s,height:o,presentation:r,customstyle:h,classlist:d.join(" ")}),this.get("host").insertContentAtFocusPoint(t),this.markUpdated()}this.getDialogue({focusAfterHide:null}).hide()}},_removeLegacyAlignment:function(i){return i.getStyle("margin")&&s.some(function(e){if(i.getStyle(e.name)!==e.value)return!1;var t=c.Node.create("
");return t.setStyle("margin",e.margin),i.getStyle("margin")===t.getStyle("margin")&&(i.addClass(this._getAlignmentClass(e.value)),i.setStyle(e.name,null),i.setStyle("margin",null),!0)},this),i},_getAlignmentClass:function(e){return u.ALIGNSETTINGS+"_"+e},_toggleVisibility:function(e,t){var i=this._form,n=i.all(e);n.setStyle("display",t?"block":"none")},_toggleAriaInvalid:function(e,t){var i=this._form;e.forEach(function(e){i.all(e).setAttribute("aria-invalid",t)})},_hasErrorUrlField:function(){var e=this._form,t=e.one("."+u.INPUTURL).get("value"),i=""===t;return this._toggleVisibility("."+u.IMAGEURLWARNING,i),this._toggleAriaInvalid(["."+u.INPUTURL],i),i},_hasErrorAltField:function(){var e=this._form,t=e.one("."+u.INPUTALT).get("value"),i=e.one("."+u.IMAGEPRESENTATION).get("checked"),n=""===t&&!i;return this._toggleVisibility("."+u.IMAGEALTWARNING,n),this._toggleAriaInvalid(["."+u.INPUTALT,"."+u.IMAGEPRESENTATION],n),n},_updateWarning:function(){var e=this._hasErrorUrlField(),t=this._hasErrorAltField(),i=e||t;return this.getDialogue().centerDialogue(),i},_handleKeyup:function(){var e=this._form,t=e.one("."+u.INPUTALT).get("value").length;e.one("#currentcount").setHTML(t)}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]}); \ No newline at end of file diff --git a/lib/editor/atto/plugins/image/yui/build/moodle-atto_image-button/moodle-atto_image-button.js b/lib/editor/atto/plugins/image/yui/build/moodle-atto_image-button/moodle-atto_image-button.js index b8275ae174d..dcbaa1e040d 100644 --- a/lib/editor/atto/plugins/image/yui/build/moodle-atto_image-button/moodle-atto_image-button.js +++ b/lib/editor/atto/plugins/image/yui/build/moodle-atto_image-button/moodle-atto_image-button.js @@ -280,16 +280,15 @@ Y.namespace('M.atto_image').Button = Y.Base.create('button', Y.M.editor_atto.Edi * * @method _handleDragDrop * @param {EventFacade} e - * @return {boolean} false if we handled the event, else true. * @private */ _handleDragDrop: function(e) { if (!e._event || !e._event.dataTransfer) { // Drop not fully supported in this browser. - return true; + return; } - return this._handlePasteOrDropHelper(e, e._event.dataTransfer); + this._handlePasteOrDropHelper(e, e._event.dataTransfer); }, /** @@ -335,13 +334,7 @@ Y.namespace('M.atto_image').Button = Y.Base.create('button', Y.M.editor_atto.Edi } if (didUpload) { - // We handled this. e.preventDefault(); - e.stopPropagation(); - return false; - } else { - // Let someone else try to handle it. - return true; } }, diff --git a/lib/editor/atto/plugins/image/yui/src/button/js/button.js b/lib/editor/atto/plugins/image/yui/src/button/js/button.js index 6d4a7560d82..95ff0304cdb 100644 --- a/lib/editor/atto/plugins/image/yui/src/button/js/button.js +++ b/lib/editor/atto/plugins/image/yui/src/button/js/button.js @@ -278,16 +278,15 @@ Y.namespace('M.atto_image').Button = Y.Base.create('button', Y.M.editor_atto.Edi * * @method _handleDragDrop * @param {EventFacade} e - * @return {boolean} false if we handled the event, else true. * @private */ _handleDragDrop: function(e) { if (!e._event || !e._event.dataTransfer) { // Drop not fully supported in this browser. - return true; + return; } - return this._handlePasteOrDropHelper(e, e._event.dataTransfer); + this._handlePasteOrDropHelper(e, e._event.dataTransfer); }, /** @@ -333,13 +332,7 @@ Y.namespace('M.atto_image').Button = Y.Base.create('button', Y.M.editor_atto.Edi } if (didUpload) { - // We handled this. e.preventDefault(); - e.stopPropagation(); - return false; - } else { - // Let someone else try to handle it. - return true; } }, diff --git a/lib/form/dndupload.js b/lib/form/dndupload.js index 6b668afe08e..f9cae45f8f0 100644 --- a/lib/form/dndupload.js +++ b/lib/form/dndupload.js @@ -174,6 +174,10 @@ M.form_dndupload.init = function(Y, options) { init_page_events: function() { this.Y.on('dragenter', this.drag_enter_page, 'body', this); this.Y.on('dragleave', this.drag_leave_page, 'body', this); + this.Y.on('drop', function() { + this.pageentercount = 0; + this.hide_drop_target(); + }.bind(this)); }, /**