From 44f85767abb57e958e363cb125a0c103fa12f4d7 Mon Sep 17 00:00:00 2001 From: Dongsheng Cai Date: Thu, 27 May 2021 16:22:17 +1000 Subject: [PATCH] MDL-71674 editor_atto: more assessible errors --- .../tests/behat/accessibilitychecker.feature | 5 +- .../atto/plugins/image/lang/en/atto_image.php | 1 + lib/editor/atto/plugins/image/lib.php | 1 + .../plugins/image/tests/behat/image.feature | 24 +++++- .../moodle-atto_image-button-debug.js | 82 +++++++++++++------ .../moodle-atto_image-button-min.js | 6 +- .../moodle-atto_image-button.js | 82 +++++++++++++------ .../plugins/image/yui/src/button/js/button.js | 82 +++++++++++++------ 8 files changed, 203 insertions(+), 80 deletions(-) diff --git a/lib/editor/atto/plugins/accessibilitychecker/tests/behat/accessibilitychecker.feature b/lib/editor/atto/plugins/accessibilitychecker/tests/behat/accessibilitychecker.feature index be495fedaae..6748b4e5dc5 100644 --- a/lib/editor/atto/plugins/accessibilitychecker/tests/behat/accessibilitychecker.feature +++ b/lib/editor/atto/plugins/accessibilitychecker/tests/behat/accessibilitychecker.feature @@ -21,8 +21,11 @@ Feature: Atto accessibility checker And I click on ".moodle-dialogue-focused .closebutton" "css_element" And I select the text in the "Description" Atto editor And I click on "Insert or edit image" "button" + And I set the field "Enter URL" to "/decorative-image.png" And I set the field "Describe this image for someone who cannot see it" to "" - And I set the field "This image is decorative only" to "1" + And I set the field "Width" to "1" + And I set the field "Height" to "1" + And I click on "This image is decorative only" "checkbox" And I press "Save image" And I press "Accessibility checker" And I should see "Congratulations, no accessibility problems found!" diff --git a/lib/editor/atto/plugins/image/lang/en/atto_image.php b/lib/editor/atto/plugins/image/lang/en/atto_image.php index b5e540d08f3..2d9de07e983 100644 --- a/lib/editor/atto/plugins/image/lang/en/atto_image.php +++ b/lib/editor/atto/plugins/image/lang/en/atto_image.php @@ -39,6 +39,7 @@ $string['imageproperties'] = 'Image properties'; $string['presentation'] = 'This image is decorative only'; $string['pluginname'] = 'Insert or edit image'; $string['presentationoraltrequired'] = 'An image must have a description, unless it is marked as decorative only.'; +$string['imageurlrequired'] = 'An image must have a URL.'; $string['preview'] = 'Preview'; $string['saveimage'] = 'Save image'; $string['size'] = 'Size'; diff --git a/lib/editor/atto/plugins/image/lib.php b/lib/editor/atto/plugins/image/lib.php index 00b3915b2b2..d832fc73853 100644 --- a/lib/editor/atto/plugins/image/lib.php +++ b/lib/editor/atto/plugins/image/lib.php @@ -47,6 +47,7 @@ function atto_image_strings_for_js() { 'height', 'presentation', 'presentationoraltrequired', + 'imageurlrequired', 'size', 'width', 'uploading', diff --git a/lib/editor/atto/plugins/image/tests/behat/image.feature b/lib/editor/atto/plugins/image/tests/behat/image.feature index c43debe219c..22d06f33285 100644 --- a/lib/editor/atto/plugins/image/tests/behat/image.feature +++ b/lib/editor/atto/plugins/image/tests/behat/image.feature @@ -58,7 +58,8 @@ Feature: Add images to Atto When I click on "Insert or edit image" "button" Then the field "Enter URL" matches value "/nothing/here" And I set the field "Describe this image for someone who cannot see it" to "Something" - And I set the field "Enter URL" to "" + And I set the field "Width" to "1" + And I set the field "Height" to "1" And I press "Save image" And I set the field "Description" to "

Image: Awesome!.

" And I press "Update profile" @@ -69,3 +70,24 @@ Feature: Add images to Atto And the field "Width" matches value "123" And the field "Height" matches value "456" And the field "Describe this image" matches value "Awesome!" + + @javascript + Scenario: Error handling when inserting an image manually + Given I log in as "admin" + And I open my profile in edit mode + And I set the field "Description" to "

Image: .

" + And I select the text in the "Description" Atto editor + When I click on "Insert or edit image" "button" + Then the field "Enter URL" matches value "/nothing/here" + And I set the field "Describe this image for someone who cannot see it" to "" + And I take focus off "Describe this image for someone who cannot see it" "field" + And I should see "An image must have a description, unless it is marked as decorative only." + And I set the field "Describe this image for someone who cannot see it" to "Something" + And I set the field "Enter URL" to "" + And I press "Save image" + And I should see "An image must have a URL." + And I set the field "Enter URL" to "/nothing/here" + And I set the field "Width" to "1" + And I set the field "Height" to "1" + And I press "Save image" + And I press "Update profile" 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 252c5aaf2ef..f20942dbce1 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 @@ -43,6 +43,7 @@ var CSS = { 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', @@ -51,6 +52,10 @@ var CSS = { IMAGEPREVIEWBOX: 'atto_image_preview_box', ALIGNSETTINGS: 'atto_image_button' }, + FORMNAMES = { + URL: 'urlentry', + ALT: 'altentry' + }, SELECTORS = { INPUTURL: '.' + CSS.INPUTURL }, @@ -96,13 +101,17 @@ var CSS = { TEMPLATE = '' + '
' + - // Add the repository browser button. + '' + '{{#if showFilepicker}}' + '
' + '' + '
' + - '' + '' + '
{{else}}
{{/if}}
0 / 125
x

'),t=this.get("host").canShowFilepicker("image"),i=m.Node.create(e({elementid:this.get("host").get("elementid"),CSS:u,component:_,showFilepicker:t,alignments:a}));return this._form=i,this._applyImageProperties(this._form),this._form.one("."+u.INPUTURL).on("blur",this._urlChanged,this),this._form.one("."+u.IMAGEPRESENTATION).on("change",this._updateWarning,this),this._form.one("."+u.INPUTALT).on("change",this._updateWarning,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.INPUTURL).on("blur",this._urlChanged,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,s,a,o,l,r,h,g,d,c;t=t||!1,i=this._form.one("."+u.INPUTWIDTH),n="width",s=this._form.one("."+u.INPUTHEIGHT),a="height",o=this._form.one("."+u.INPUTCONSTRAIN),l=i.get("value"),r=s.get("value"),h=this._form.one("."+u.IMAGEPREVIEW),this._rawImageDimensions&&(""===l&&(l=this._rawImageDimensions[n],i.set("value",l),l=i.get("value")),h.setStyles({width:null,height:null}),o.get("checked")?(t&&(c=i,i=s,s=c,c=n,n=a,a=c,c=l,l=r,r=c),l.match(I)?(r=l,g=parseInt(l,10),d=this._rawImageDimensions.width/100*g,h.setStyle("width",d),d=this._rawImageDimensions.height/100*g,h.setStyle("height",d)):(r=Math.round(l/this._rawImageDimensions[n]*this._rawImageDimensions[a]),t?h.setStyles({width:r,height:l}):h.setStyles({width:l,height:r})),s.set("value",r)):(l.match(I)?(g=parseInt(l,10),d=this._rawImageDimensions.width/100*g,h.setStyle("width",d+"px")):h.setStyle("width",l+"px"),r.match(I)?(g=parseInt(r,10),d=this._rawImageDimensions.height/100*g,h.setStyle("height",d+"px")):h.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 a.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,s={src:null,alt:null,width:null,height:null,align:"",presentation:!1},a=this.get("host").getSelectedNodes();return(a=a&&a.filter("img"))&&a.size()?(n=this._removeLegacyAlignment(a.item(0)),i=(this._selectedImage=n).getAttribute("style"),s.customstyle=i,(e=n.getAttribute("width")).match(I)||(e=parseInt(e,10)),(t=n.getAttribute("height")).match(I)||(t=parseInt(t,10)),0!==e&&(s.width=e),0!==t&&(s.height=t),this._getAlignmentPropeties(n,s),s.src=n.getAttribute("src"),s.alt=n.getAttribute("alt")||"",s.presentation="presentation"===n.get("role"),s):(this._selectedImage=null,!1)},_getAlignmentPropeties:function(i,n){var s;!a.some(function(e){var t=this._getAlignmentClass(e.value);return i.hasClass(t)?(n.align=e.value,!0):(e.isDefault&&(s=e.value),!1)},this)&&s&&(n.align=s)},_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"),s=i.one("."+u.INPUTALT).get("value"),a=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"),h=i.one("."+u.INPUTCONSTRAIN).get("checked"),g=i.one("."+u.INPUTCUSTOMSTYLE).get("value"),d=[],c=this.get("host");if(e.preventDefault(),!this._updateWarning()){if(c.focus(),""!==n){if(this._selectedImage?c.setSelection(c.getSelectionFromNode(this._selectedImage)):c.setSelection(this._currentSelection),h&&d.push(u.RESPONSIVE),d.push(l),!a.match(I)&&isNaN(parseInt(a,10)))return void i.one("."+u.INPUTWIDTH).focus();if(!o.match(I)&&isNaN(parseInt(o,10)))return void i.one("."+u.INPUTHEIGHT).focus();t=m.Handlebars.compile(p)({url:n,alt:s,width:a,height:o,presentation:r,customstyle:g,classlist:d.join(" ")}),this.get("host").insertContentAtFocusPoint(t),this.markUpdated()}this.getDialogue({focusAfterHide:null}).hide()}},_removeLegacyAlignment:function(i){return i.getStyle("margin")&&a.some(function(e){if(i.getStyle(e.name)!==e.value)return!1;var t=m.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},_updateWarning:function(){var e=this._form,t=!0,i=e.one("."+u.INPUTALT).get("value"),n=e.one("."+u.IMAGEPRESENTATION).get("checked");return t=""!==i||n?(e.one("."+u.IMAGEALTWARNING).setStyle("display","none"),e.one("."+u.INPUTALT).setAttribute("aria-invalid",!1),e.one("."+u.IMAGEPRESENTATION).setAttribute("aria-invalid",!1),!1):(e.one("."+u.IMAGEALTWARNING).setStyle("display","block"),e.one("."+u.INPUTALT).setAttribute("aria-invalid",!0),e.one("."+u.IMAGEPRESENTATION).setAttribute("aria-invalid",!0),!0),this.getDialogue().centerDialogue(),t},_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"}],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,h,g,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"),h=this._form.one("."+u.IMAGEPREVIEW),this._rawImageDimensions&&(""===l&&(l=this._rawImageDimensions[n],i.set("value",l),l=i.get("value")),h.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,g=parseInt(l,10),d=this._rawImageDimensions.width/100*g,h.setStyle("width",d),d=this._rawImageDimensions.height/100*g,h.setStyle("height",d)):(r=Math.round(l/this._rawImageDimensions[n]*this._rawImageDimensions[s]),t?h.setStyles({width:r,height:l}):h.setStyles({width:l,height:r})),a.set("value",r)):(l.match(I)?(g=parseInt(l,10),d=this._rawImageDimensions.width/100*g,h.setStyle("width",d+"px")):h.setStyle("width",l+"px"),r.match(I)?(g=parseInt(r,10),d=this._rawImageDimensions.height/100*g,h.setStyle("height",d+"px")):h.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"),h=i.one("."+u.INPUTCONSTRAIN).get("checked"),g=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),h&&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:g,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 7dc42ca3685..418fc17aac7 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 @@ -43,6 +43,7 @@ var CSS = { 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', @@ -51,6 +52,10 @@ var CSS = { IMAGEPREVIEWBOX: 'atto_image_preview_box', ALIGNSETTINGS: 'atto_image_button' }, + FORMNAMES = { + URL: 'urlentry', + ALT: 'altentry' + }, SELECTORS = { INPUTURL: '.' + CSS.INPUTURL }, @@ -96,13 +101,17 @@ var CSS = { TEMPLATE = '' + '
' + - // Add the repository browser button. + '' + '{{#if showFilepicker}}' + '
' + '' + '
' + - '' + '' + '