0){var a=e.one(o[0]),f=a.getAttribute("width"),l=a.getAttribute("height");f>0&&e.one("#atto_image_widthentry").set("value",f),l>0&&e.one("#atto_image_heightentry").set("value",l),e.one("#atto_image_preview").set("src",a.get("src")),e.one("#atto_image_preview").setStyle("display","inline"),e.one("#atto_image_altentry").set("value",a.get("alt")),e.one("#atto_image_urlentry").set("value",a.get("src"));var c=a.get("role");c==="presentation"&&e.one("#atto_image_presentation").set("checked","checked")}r.show()}},r=M.util.image_url("e/insert_edit_image","core");M.editor_atto.add_toolbar_button(t.elementid,"image",r,t.group,n,this)},open_filepicker:function(e){var t=this.getAttribute("data-editor");e.preventDefault(),M.editor_atto.show_filepicker(t,"image",M.atto_image.filepicker_callback)},filepicker_callback:function(t){if(t.url!==""){var n=e.one("#atto_image_urlentry");n.set("value",t.url);var r=new Image;r.onload=function(){e.one("#atto_image_widthentry").set("value",this.width),e.one("#atto_image_heightentry").set("value",this.height),e.one("#atto_image_preview").set("src",this.src),e.one("#atto_image_preview").setStyle("display","inline")},r.src=t.url}},url_changed:function(){var t=e.one("#atto_image_urlentry");if(t.get("value")!==""){var n=new Image;n.onload=function(){var t;t=e.one("#atto_image_widthentry"),t.get("value")===""&&t.set("value",this.width),t=e.one("#atto_image_heightentry"),t.get("value")===""&&t.set("value",this.height),t=e.one("#atto_image_preview"),t.set("src",this.src),t.setStyle("display","inline")},n.src=t.get("value")}},set_image:function(t,n){var r=t.currentTarget.ancestor(".atto_form").one("#atto_image_urlentry"),i=r.get("value");r=t.currentTarget.ancestor(".atto_form").one("#atto_image_altentry");var s=r.get("value");r=t.currentTarget.ancestor(".atto_form").one("#atto_image_widthentry");var o=r.get("value");r=t.currentTarget.ancestor(".atto_form").one("#atto_image_heightentry");var u=r.get("value");r=t.currentTarget.ancestor(".atto_form").one("#atto_image_presentation");var a=r.get("checked"),f;t.preventDefault();if(s===""&&!a){f=t.currentTarget.ancestor(".atto_form").one("#atto_image_altwarning"),f.setStyle("display","block"),r=t.currentTarget.ancestor(".atto_form").one("#atto_image_altentry"),r.setAttribute("aria-invalid",!0),r=t.currentTarget.ancestor(".atto_form").one("#atto_image_presentation"),r.setAttribute("aria-invalid",!0);return}f=t.currentTarget.ancestor(".atto_form").one("#atto_image_altwarning"),f.setStyle("display","none"),r=t.currentTarget.ancestor(".atto_form").one("#atto_image_altentry"),r.setAttribute("aria-invalid",!1),r=t.currentTarget.ancestor(".atto_form").one("#atto_image_presentation"),r.setAttribute("aria-invalid",!1),M.atto_image.dialogue.hide();if(i!==""){M.editor_atto.set_selection(M.atto_image.selection);var l='",document.selection&&document.selection.createRange().pasteHTML?document.selection.createRange().pasteHTML(l):document.execCommand("insertHTML",!1,l),M.editor_atto.text_updated(n)}},get_form_content:function(t){var n='"+"
"+M.util.get_string("accessibilityhint","atto_image");var r=e.Node.create(n);return r.one("#atto_image_urlentry").on("blur",M.atto_image.url_changed,this),r.one("#atto_image_urlentrysubmit").on("click",M.atto_image.set_image,this,t),M.editor_atto.can_show_filepicker(t,"image")&&r.one("#openimagebrowser").on("click",M.atto_image.open_filepicker),
+r}}},"@VERSION@",{requires:["node","escape"]});
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 92c12f49a11..d9d39e0a505 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
@@ -200,49 +200,55 @@ M.atto_image = M.atto_image || {
}
},
get_form_content : function(elementid) {
- var content = Y.Node.create('' +
- '
' + M.util.get_string('accessibilityhint', 'atto_image'));
+ var html = '' +
+ '
' + M.util.get_string('accessibilityhint', 'atto_image');
+
+ var content = Y.Node.create(html);
content.one('#atto_image_urlentry').on('blur', M.atto_image.url_changed, this);
content.one('#atto_image_urlentrysubmit').on('click', M.atto_image.set_image, this, elementid);
- content.one('#openimagebrowser').on('click', M.atto_image.open_filepicker);
+ if (M.editor_atto.can_show_filepicker(elementid, 'image')) {
+ content.one('#openimagebrowser').on('click', M.atto_image.open_filepicker);
+ }
return content;
}
};
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 83840d65b8b..66c5c55cb83 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
@@ -198,49 +198,55 @@ M.atto_image = M.atto_image || {
}
},
get_form_content : function(elementid) {
- var content = Y.Node.create('' +
- '
' + M.util.get_string('accessibilityhint', 'atto_image'));
+ var html = '' +
+ '
' + M.util.get_string('accessibilityhint', 'atto_image');
+
+ var content = Y.Node.create(html);
content.one('#atto_image_urlentry').on('blur', M.atto_image.url_changed, this);
content.one('#atto_image_urlentrysubmit').on('click', M.atto_image.set_image, this, elementid);
- content.one('#openimagebrowser').on('click', M.atto_image.open_filepicker);
+ if (M.editor_atto.can_show_filepicker(elementid, 'image')) {
+ content.one('#openimagebrowser').on('click', M.atto_image.open_filepicker);
+ }
return content;
}
};
diff --git a/lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button-debug.js b/lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button-debug.js
index ce89f7bd1c1..253db5a530c 100644
--- a/lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button-debug.js
+++ b/lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button-debug.js
@@ -238,29 +238,35 @@ M.atto_link = M.atto_link || {
* @return string
*/
get_form_content : function(elementid) {
- var content = Y.Node.create('' +
- '
' + M.util.get_string('accessibilityhint', 'atto_link'));
+ var html = '' +
+ '
' + M.util.get_string('accessibilityhint', 'atto_link');
+
+ var content = Y.Node.create(html);
content.one('#atto_link_urlentrysubmit').on('click', M.atto_link.set_link, this, elementid);
- content.one('#openlinkbrowser').on('click', M.atto_link.open_filepicker);
+ if (M.editor_atto.can_show_filepicker(elementid, 'link')) {
+ content.one('#openlinkbrowser').on('click', M.atto_link.open_filepicker);
+ }
return content;
}
};
diff --git a/lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button-min.js b/lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button-min.js
index cb6dbd6e6fa..b2b4af91168 100644
--- a/lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button-min.js
+++ b/lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button-min.js
@@ -1 +1 @@
-YUI.add("moodle-atto_link-button",function(e,t){M.atto_link=M.atto_link||{dialogue:null,selection:null,display_chooser:function(e,t){e.preventDefault(),M.editor_atto.is_active(t)||M.editor_atto.focus(t),M.atto_link.selection=M.editor_atto.get_selection();if(M.atto_link.selection!==!1&&!M.atto_link.selection.collapsed){var n;M.atto_link.dialogue?n=M.atto_link.dialogue:n=new M.core.dialogue({visible:!1,modal:!0,close:!0,draggable:!0}),n.render(),n.set("bodyContent",M.atto_link.get_form_content(t)),n.set("headerContent",M.util.get_string("createlink","atto_link")),M.atto_link.resolve_anchors(),n.show(),M.atto_link.dialogue=n}},init:function(e){var t=M.util.image_url("e/insert_edit_link","core");M.editor_atto.add_toolbar_button(e.elementid,"link",t,e.group,this.display_chooser,this)},resolve_anchors:function(){var t=M.editor_atto.get_selection_parent_node(),n,r,i;if(!t)return;n=M.atto_link.find_selected_anchors(e.one(t)),n.length>0&&(r=n[0],M.atto_link.selection=M.editor_atto.get_selection_from_node(r),i=r.getAttribute("href"),target=r.getAttribute("target"),i!==""&&e.one("#atto_link_urlentry").set("value",i),target==="_blank"?e.one("#atto_link_openinnewwindow").set("checked","checked"):e.one("#atto_link_openinnewwindow").set("checked",""))},open_filepicker:function(e){var t=this.getAttribute("data-editor");e.preventDefault(),M.editor_atto.show_filepicker(t,"link",M.atto_link.filepicker_callback)},filepicker_callback:function(e){M.atto_link.dialogue.hide(),e.url!==""&&(M.editor_atto.set_selection(M.atto_link.selection),document.execCommand("unlink",!1,null),document.execCommand("createLink",!1,e.url))},set_link:function(t,n){var r,i,s,o,u;t.preventDefault(),M.atto_link.dialogue.hide(),r=t.currentTarget.ancestor(".atto_form").one("input[type=url]"),u=r.get("value");if(u!==""){M.editor_atto.set_selection(M.atto_link.selection),document.execCommand("unlink",!1,null),document.execCommand("createLink",!1,u),s=M.editor_atto.get_selection_parent_node();if(!s)return;o=M.atto_link.find_selected_anchors(e.one(s)),e.Array.each(o,function(e){i=t.currentTarget.ancestor(".atto_form").one("input[type=checkbox]"),i.get("checked")?e.setAttribute("target","_blank"):e.removeAttribute("target")}),M.editor_atto.text_updated(n)}},find_selected_anchors:function(e){var t=e.get("tagName"),n,r;return t&&t.toLowerCase()==="a"?[e]:(r=[],e.all("a").each(function(e){!n&&M.editor_atto.selection_contains_node(e)&&r.push(e)}),r.length>0?r:(n=e.ancestor("a"),n?[n]:[]))},get_form_content:function(t){var n=e.Node.create('"+"
"+M.util.get_string("accessibilityhint","atto_link"));return n.one("#atto_link_urlentrysubmit").on("click",M.atto_link.set_link,this,t),n.one("#openlinkbrowser").on("click",M.atto_link.open_filepicker),n}}},"@VERSION@",{requires:["node","escape"]});
+YUI.add("moodle-atto_link-button",function(e,t){M.atto_link=M.atto_link||{dialogue:null,selection:null,display_chooser:function(e,t){e.preventDefault(),M.editor_atto.is_active(t)||M.editor_atto.focus(t),M.atto_link.selection=M.editor_atto.get_selection();if(M.atto_link.selection!==!1&&!M.atto_link.selection.collapsed){var n;M.atto_link.dialogue?n=M.atto_link.dialogue:n=new M.core.dialogue({visible:!1,modal:!0,close:!0,draggable:!0}),n.render(),n.set("bodyContent",M.atto_link.get_form_content(t)),n.set("headerContent",M.util.get_string("createlink","atto_link")),M.atto_link.resolve_anchors(),n.show(),M.atto_link.dialogue=n}},init:function(e){var t=M.util.image_url("e/insert_edit_link","core");M.editor_atto.add_toolbar_button(e.elementid,"link",t,e.group,this.display_chooser,this)},resolve_anchors:function(){var t=M.editor_atto.get_selection_parent_node(),n,r,i;if(!t)return;n=M.atto_link.find_selected_anchors(e.one(t)),n.length>0&&(r=n[0],M.atto_link.selection=M.editor_atto.get_selection_from_node(r),i=r.getAttribute("href"),target=r.getAttribute("target"),i!==""&&e.one("#atto_link_urlentry").set("value",i),target==="_blank"?e.one("#atto_link_openinnewwindow").set("checked","checked"):e.one("#atto_link_openinnewwindow").set("checked",""))},open_filepicker:function(e){var t=this.getAttribute("data-editor");e.preventDefault(),M.editor_atto.show_filepicker(t,"link",M.atto_link.filepicker_callback)},filepicker_callback:function(e){M.atto_link.dialogue.hide(),e.url!==""&&(M.editor_atto.set_selection(M.atto_link.selection),document.execCommand("unlink",!1,null),document.execCommand("createLink",!1,e.url))},set_link:function(t,n){var r,i,s,o,u;t.preventDefault(),M.atto_link.dialogue.hide(),r=t.currentTarget.ancestor(".atto_form").one("input[type=url]"),u=r.get("value");if(u!==""){M.editor_atto.set_selection(M.atto_link.selection),document.execCommand("unlink",!1,null),document.execCommand("createLink",!1,u),s=M.editor_atto.get_selection_parent_node();if(!s)return;o=M.atto_link.find_selected_anchors(e.one(s)),e.Array.each(o,function(e){i=t.currentTarget.ancestor(".atto_form").one("input[type=checkbox]"),i.get("checked")?e.setAttribute("target","_blank"):e.removeAttribute("target")}),M.editor_atto.text_updated(n)}},find_selected_anchors:function(e){var t=e.get("tagName"),n,r;return t&&t.toLowerCase()==="a"?[e]:(r=[],e.all("a").each(function(e){!n&&M.editor_atto.selection_contains_node(e)&&r.push(e)}),r.length>0?r:(n=e.ancestor("a"),n?[n]:[]))},get_form_content:function(t){var n='"+"
"+M.util.get_string("accessibilityhint","atto_link");var r=e.Node.create(n);return r.one("#atto_link_urlentrysubmit").on("click",M.atto_link.set_link,this,t),M.editor_atto.can_show_filepicker(t,"link")&&r.one("#openlinkbrowser").on("click",M.atto_link.open_filepicker),r}}},"@VERSION@",{requires:["node","escape"]});
diff --git a/lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button.js b/lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button.js
index ce89f7bd1c1..253db5a530c 100644
--- a/lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button.js
+++ b/lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button.js
@@ -238,29 +238,35 @@ M.atto_link = M.atto_link || {
* @return string
*/
get_form_content : function(elementid) {
- var content = Y.Node.create('' +
- '
' + M.util.get_string('accessibilityhint', 'atto_link'));
+ var html = '' +
+ '
' + M.util.get_string('accessibilityhint', 'atto_link');
+
+ var content = Y.Node.create(html);
content.one('#atto_link_urlentrysubmit').on('click', M.atto_link.set_link, this, elementid);
- content.one('#openlinkbrowser').on('click', M.atto_link.open_filepicker);
+ if (M.editor_atto.can_show_filepicker(elementid, 'link')) {
+ content.one('#openlinkbrowser').on('click', M.atto_link.open_filepicker);
+ }
return content;
}
};
diff --git a/lib/editor/atto/plugins/link/yui/src/button/js/button.js b/lib/editor/atto/plugins/link/yui/src/button/js/button.js
index 85a96c05b85..1bd20182c1f 100644
--- a/lib/editor/atto/plugins/link/yui/src/button/js/button.js
+++ b/lib/editor/atto/plugins/link/yui/src/button/js/button.js
@@ -236,29 +236,35 @@ M.atto_link = M.atto_link || {
* @return string
*/
get_form_content : function(elementid) {
- var content = Y.Node.create('' +
- '
' + M.util.get_string('accessibilityhint', 'atto_link'));
+ var html = '' +
+ '
' + M.util.get_string('accessibilityhint', 'atto_link');
+
+ var content = Y.Node.create(html);
content.one('#atto_link_urlentrysubmit').on('click', M.atto_link.set_link, this, elementid);
- content.one('#openlinkbrowser').on('click', M.atto_link.open_filepicker);
+ if (M.editor_atto.can_show_filepicker(elementid, 'link')) {
+ content.one('#openlinkbrowser').on('click', M.atto_link.open_filepicker);
+ }
return content;
}
};
diff --git a/lib/editor/atto/plugins/media/yui/build/moodle-atto_media-button/moodle-atto_media-button-debug.js b/lib/editor/atto/plugins/media/yui/build/moodle-atto_media-button/moodle-atto_media-button-debug.js
index e5587493c06..8bda5eacac3 100644
--- a/lib/editor/atto/plugins/media/yui/build/moodle-atto_media-button/moodle-atto_media-button-debug.js
+++ b/lib/editor/atto/plugins/media/yui/build/moodle-atto_media-button/moodle-atto_media-button-debug.js
@@ -26,6 +26,11 @@ M.atto_media = M.atto_media || {
dialogue : null,
selection : null,
init : function(params) {
+
+ if (!M.editor_atto.can_show_filepicker(params.elementid, 'media')) {
+ // Do not show this button if we can't browse repositories.
+ return;
+ }
var display_chooser = function(e, elementid) {
e.preventDefault();
if (!M.editor_atto.is_active(elementid)) {
diff --git a/lib/editor/atto/plugins/media/yui/build/moodle-atto_media-button/moodle-atto_media-button-min.js b/lib/editor/atto/plugins/media/yui/build/moodle-atto_media-button/moodle-atto_media-button-min.js
index 9571db3c8c0..3a246f7aa84 100644
--- a/lib/editor/atto/plugins/media/yui/build/moodle-atto_media-button/moodle-atto_media-button-min.js
+++ b/lib/editor/atto/plugins/media/yui/build/moodle-atto_media-button/moodle-atto_media-button-min.js
@@ -1 +1 @@
-YUI.add("moodle-atto_media-button",function(e,t){M.atto_media=M.atto_media||{dialogue:null,selection:null,init:function(e){var t=function(e,t){e.preventDefault(),M.editor_atto.is_active(t)||M.editor_atto.focus(t),M.atto_media.selection=M.editor_atto.get_selection();if(M.atto_media.selection!==!1){var n;M.atto_media.dialogue?n=M.atto_media.dialogue:n=new M.core.dialogue({visible:!1,modal:!0,close:!0,draggable:!0}),n.render(),n.set("bodyContent",M.atto_media.get_form_content(t)),n.set("headerContent",M.util.get_string("createmedia","atto_media")),n.centerDialogue(),n.show(),M.atto_media.dialogue=n}},n=M.util.image_url("e/insert_edit_video","core");M.editor_atto.add_toolbar_button(e.elementid,"media",n,e.group,t,this)},open_browser:function(e){var t=this.getAttribute("data-editor");e.preventDefault(),M.editor_atto.show_filepicker(t,"media",M.atto_media.filepicker_callback)},filepicker_callback:function(t){if(t.url!==""){var n=e.one("#atto_media_urlentry");n.set("value",t.url),n=e.one("#atto_media_nameentry"),n.set("value",t.file)}},set_media:function(t,n){t.preventDefault(),M.atto_media.dialogue.hide();var r=t.currentTarget.ancestor(".atto_form").one("#atto_media_urlentry"),i=r.get("value");r=t.currentTarget.ancestor(".atto_form").one("#atto_media_nameentry");var s=r.get("value");if(i!==""&&s!==""){M.editor_atto.set_selection(M.atto_media.selection);var o=''+s+"";document.selection&&document.selection.createRange().pasteHTML?document.selection.createRange().pasteHTML(o):document.execCommand("insertHTML",!1,o),M.editor_atto.text_updated(n)}},get_form_content:function(t){var n=e.Node.create('"+"
"+M.util.get_string("accessibilityhint","atto_media"));return n.one("#atto_media_urlentrysubmit").on("click",M.atto_media.set_media,this,t),n.one("#openmediabrowser").on("click",M.atto_media.open_browser),n}}},"@VERSION@",{requires:["node","escape"]});
+YUI.add("moodle-atto_media-button",function(e,t){M.atto_media=M.atto_media||{dialogue:null,selection:null,init:function(e){if(!M.editor_atto.can_show_filepicker(e.elementid,"media"))return;var t=function(e,t){e.preventDefault(),M.editor_atto.is_active(t)||M.editor_atto.focus(t),M.atto_media.selection=M.editor_atto.get_selection();if(M.atto_media.selection!==!1){var n;M.atto_media.dialogue?n=M.atto_media.dialogue:n=new M.core.dialogue({visible:!1,modal:!0,close:!0,draggable:!0}),n.render(),n.set("bodyContent",M.atto_media.get_form_content(t)),n.set("headerContent",M.util.get_string("createmedia","atto_media")),n.centerDialogue(),n.show(),M.atto_media.dialogue=n}},n=M.util.image_url("e/insert_edit_video","core");M.editor_atto.add_toolbar_button(e.elementid,"media",n,e.group,t,this)},open_browser:function(e){var t=this.getAttribute("data-editor");e.preventDefault(),M.editor_atto.show_filepicker(t,"media",M.atto_media.filepicker_callback)},filepicker_callback:function(t){if(t.url!==""){var n=e.one("#atto_media_urlentry");n.set("value",t.url),n=e.one("#atto_media_nameentry"),n.set("value",t.file)}},set_media:function(t,n){t.preventDefault(),M.atto_media.dialogue.hide();var r=t.currentTarget.ancestor(".atto_form").one("#atto_media_urlentry"),i=r.get("value");r=t.currentTarget.ancestor(".atto_form").one("#atto_media_nameentry");var s=r.get("value");if(i!==""&&s!==""){M.editor_atto.set_selection(M.atto_media.selection);var o=''+s+"";document.selection&&document.selection.createRange().pasteHTML?document.selection.createRange().pasteHTML(o):document.execCommand("insertHTML",!1,o),M.editor_atto.text_updated(n)}},get_form_content:function(t){var n=e.Node.create('"+"
"+M.util.get_string("accessibilityhint","atto_media"));return n.one("#atto_media_urlentrysubmit").on("click",M.atto_media.set_media,this,t),n.one("#openmediabrowser").on("click",M.atto_media.open_browser),n}}},"@VERSION@",{requires:["node","escape"]});
diff --git a/lib/editor/atto/plugins/media/yui/build/moodle-atto_media-button/moodle-atto_media-button.js b/lib/editor/atto/plugins/media/yui/build/moodle-atto_media-button/moodle-atto_media-button.js
index e5587493c06..8bda5eacac3 100644
--- a/lib/editor/atto/plugins/media/yui/build/moodle-atto_media-button/moodle-atto_media-button.js
+++ b/lib/editor/atto/plugins/media/yui/build/moodle-atto_media-button/moodle-atto_media-button.js
@@ -26,6 +26,11 @@ M.atto_media = M.atto_media || {
dialogue : null,
selection : null,
init : function(params) {
+
+ if (!M.editor_atto.can_show_filepicker(params.elementid, 'media')) {
+ // Do not show this button if we can't browse repositories.
+ return;
+ }
var display_chooser = function(e, elementid) {
e.preventDefault();
if (!M.editor_atto.is_active(elementid)) {
diff --git a/lib/editor/atto/plugins/media/yui/src/button/js/button.js b/lib/editor/atto/plugins/media/yui/src/button/js/button.js
index 4b5c3bc3e36..1a108a5eb90 100644
--- a/lib/editor/atto/plugins/media/yui/src/button/js/button.js
+++ b/lib/editor/atto/plugins/media/yui/src/button/js/button.js
@@ -24,6 +24,11 @@ M.atto_media = M.atto_media || {
dialogue : null,
selection : null,
init : function(params) {
+
+ if (!M.editor_atto.can_show_filepicker(params.elementid, 'media')) {
+ // Do not show this button if we can't browse repositories.
+ return;
+ }
var display_chooser = function(e, elementid) {
e.preventDefault();
if (!M.editor_atto.is_active(elementid)) {
diff --git a/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-debug.js b/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-debug.js
index 9f825f3800b..b57dbf19741 100644
--- a/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-debug.js
+++ b/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-debug.js
@@ -355,7 +355,6 @@ M.editor_atto = M.editor_atto || {
* @param object params for this editor instance.
*/
init : function(params) {
- var textarea = Y.one('#' +params.elementid);
var wrapper = Y.Node.create('');
var atto = Y.Node.create('');
+ var elementid = params.elementid.replace(':', '\\:');
+ var textarea = Y.one('#' +elementid);
+
content.appendChild(atto);
// Add everything to the wrapper.
@@ -395,19 +397,19 @@ M.editor_atto = M.editor_atto || {
// Copy the current value back to the textarea when focus leaves us.
atto.on('blur', function() {
- this.text_updated(params.elementid);
+ this.text_updated(elementid);
}, this);
// Listen for Arrow left and Arrow right keys.
Y.one(Y.config.doc.body).delegate('key',
this.keyboard_navigation,
'down:37,39',
- '#' + params.elementid + '_toolbar',
+ '#' + elementid + '_toolbar',
this,
- params.elementid);
+ elementid);
// Save the file picker options for later.
- M.editor_atto.filepickeroptions[params.elementid] = params.filepickeroptions;
+ M.editor_atto.filepickeroptions[elementid] = params.filepickeroptions;
// Init each of the plugins
var i, j;
@@ -415,7 +417,7 @@ M.editor_atto = M.editor_atto || {
var group = params.plugins[i].group;
for (j = 0; j < params.plugins[i].plugins.length; j++) {
var plugin = params.plugins[i].plugins[j];
- plugin.params.elementid = params.elementid;
+ plugin.params.elementid = elementid;
plugin.params.group = group;
M['atto_' + plugin.name].init(plugin.params);
@@ -507,6 +509,18 @@ M.editor_atto = M.editor_atto || {
Y.one('#' + elementid + '_toolbar').setAttribute('aria-activedescendant', current.generateID());
},
+ /**
+ * Should we show the filepicker for this filetype?
+ *
+ * @param string elementid for this editor instance.
+ * @param string type The media type for the file picker
+ * @return boolean
+ */
+ can_show_filepicker : function(elementid, type) {
+ var options = M.editor_atto.filepickeroptions[elementid];
+ return ((typeof options[type]) !== "undefined");
+ },
+
/**
* Show the filepicker.
* @param string elementid for this editor instance.
diff --git a/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-min.js b/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-min.js
index c3007820608..d4bc57078fa 100644
--- a/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-min.js
+++ b/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-min.js
@@ -1,2 +1,2 @@
-YUI.add("moodle-editor_atto-editor",function(e,t){CSS={CONTENT:"editor_atto_content",CONTENTWRAPPER:"editor_atto_content_wrap",TOOLBAR:"editor_atto_toolbar",WRAPPER:"editor_atto"},M.editor_atto=M.editor_atto||{buttonhandlers:{},textupdatedhandlers:{},menus:{},menuhandlers:{},filepickeroptions:{},widgets:{},showhide_menu_handler:function(e){e.preventDefault();var t=this.getAttribute("disabled"),n=this.getAttribute("data-menu"),r=M.editor_atto.menus[n],i=r.get("bodyContent");r.get("visible")||t?(r.hide(),i.detach("clickoutside")):(i.on("clickoutside",function(e){e.target.ancestor()!==this&&e.target!==this&&r.get("visible")&&(i.detach("clickoutside"),r.hide())},this),r.show(),r.bodyNode.one("a").focus())},buttonclicked_handler:function(e){var t=this.getAttribute("data-editor"),n=this.getAttribute("data-plugin"),r=this.getAttribute("data-handler"),i=M.editor_atto.menus[n+"_"+t];i&&i.hide();if(M.editor_atto.is_enabled(t,n))return r=M.editor_atto.buttonhandlers[r],r(e,t)},is_enabled:function(t,n){var r=e.one("#"+t+"_toolbar .atto_"+n+"_button");return!r.hasAttribute("disabled")},disable_all_widgets:function(t){var n,r;for(n in M.editor_atto.widgets)r=e.one("#"+t+"_toolbar .atto_"+n+"_button"),r&&r.setAttribute("disabled","true")},enable_widget:function(t,n){var r=e.one("#"+t+"_toolbar .atto_"+n+"_button");r&&r.removeAttribute("disabled")},enable_all_widgets:function(t){var n,r;for(n in M.editor_atto.widgets)r=e.one("#"+t+"_toolbar .atto_"+n+"_button"),r&&r.removeAttribute("disabled")},add_text_updated_handler:function(e,t){e in M.editor_atto.textupdatedhandlers||(M.editor_atto.textupdatedhandlers[e]=[]),M.editor_atto.textupdatedhandlers[e].push(t)},add_toolbar_menu:function(t,n,r,i,s){var o=e.one("#"+t+"_toolbar"),u=e.one("#"+t+"_toolbar .atto_group."+i+"_group"),a,f,l;u||(u=e.Node.create(''),o.append(u)),l=M.util.image_url("t/expanded","moodle"),f=e.Node.create('"),u.append(f),a=o.getAttribute("aria-activedescendant"),a||(f.setAttribute("tabindex","0"),o.setAttribute("aria-activedescendant",f.generateID())),M.editor_atto.widgets[n]=n;var c=e.Node.create(''),h=0,p={};for(h=0;h