mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 12:40:01 +01:00
Merge branch 'MDL-44972-master' of git://github.com/damyon/moodle
This commit is contained in:
commit
d0144cd38e
@ -209,7 +209,8 @@ Y.namespace('M.atto_equation').Button = Y.Base.create('button', Y.M.editor_atto.
|
|||||||
var dialogue = this.getDialogue({
|
var dialogue = this.getDialogue({
|
||||||
headerContent: M.util.get_string('pluginname', COMPONENTNAME),
|
headerContent: M.util.get_string('pluginname', COMPONENTNAME),
|
||||||
focusAfterHide: true,
|
focusAfterHide: true,
|
||||||
width: 600
|
width: 600,
|
||||||
|
focusOnShowSelector: SELECTORS.EQUATION_TEXT
|
||||||
});
|
});
|
||||||
|
|
||||||
var content = this._getDialogueContent();
|
var content = this._getDialogueContent();
|
||||||
|
File diff suppressed because one or more lines are too long
@ -209,7 +209,8 @@ Y.namespace('M.atto_equation').Button = Y.Base.create('button', Y.M.editor_atto.
|
|||||||
var dialogue = this.getDialogue({
|
var dialogue = this.getDialogue({
|
||||||
headerContent: M.util.get_string('pluginname', COMPONENTNAME),
|
headerContent: M.util.get_string('pluginname', COMPONENTNAME),
|
||||||
focusAfterHide: true,
|
focusAfterHide: true,
|
||||||
width: 600
|
width: 600,
|
||||||
|
focusOnShowSelector: SELECTORS.EQUATION_TEXT
|
||||||
});
|
});
|
||||||
|
|
||||||
var content = this._getDialogueContent();
|
var content = this._getDialogueContent();
|
||||||
|
@ -207,7 +207,8 @@ Y.namespace('M.atto_equation').Button = Y.Base.create('button', Y.M.editor_atto.
|
|||||||
var dialogue = this.getDialogue({
|
var dialogue = this.getDialogue({
|
||||||
headerContent: M.util.get_string('pluginname', COMPONENTNAME),
|
headerContent: M.util.get_string('pluginname', COMPONENTNAME),
|
||||||
focusAfterHide: true,
|
focusAfterHide: true,
|
||||||
width: 600
|
width: 600,
|
||||||
|
focusOnShowSelector: SELECTORS.EQUATION_TEXT
|
||||||
});
|
});
|
||||||
|
|
||||||
var content = this._getDialogueContent();
|
var content = this._getDialogueContent();
|
||||||
|
@ -50,6 +50,9 @@ var CSS = {
|
|||||||
IMAGEPREVIEW: 'atto_image_preview',
|
IMAGEPREVIEW: 'atto_image_preview',
|
||||||
IMAGEPREVIEWBOX: 'atto_image_preview_box'
|
IMAGEPREVIEWBOX: 'atto_image_preview_box'
|
||||||
},
|
},
|
||||||
|
SELECTORS = {
|
||||||
|
INPUTURL: '.' + CSS.INPUTURL
|
||||||
|
},
|
||||||
ALIGNMENTS = [
|
ALIGNMENTS = [
|
||||||
// Vertical alignment.
|
// Vertical alignment.
|
||||||
{
|
{
|
||||||
@ -253,7 +256,8 @@ Y.namespace('M.atto_image').Button = Y.Base.create('button', Y.M.editor_atto.Edi
|
|||||||
var dialogue = this.getDialogue({
|
var dialogue = this.getDialogue({
|
||||||
headerContent: M.util.get_string('imageproperties', COMPONENTNAME),
|
headerContent: M.util.get_string('imageproperties', COMPONENTNAME),
|
||||||
width: '480px',
|
width: '480px',
|
||||||
focusAfterHide: true
|
focusAfterHide: true,
|
||||||
|
focusOnShowSelector: SELECTORS.INPUTURL
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set the dialogue content, and then show the dialogue.
|
// Set the dialogue content, and then show the dialogue.
|
||||||
|
File diff suppressed because one or more lines are too long
@ -50,6 +50,9 @@ var CSS = {
|
|||||||
IMAGEPREVIEW: 'atto_image_preview',
|
IMAGEPREVIEW: 'atto_image_preview',
|
||||||
IMAGEPREVIEWBOX: 'atto_image_preview_box'
|
IMAGEPREVIEWBOX: 'atto_image_preview_box'
|
||||||
},
|
},
|
||||||
|
SELECTORS = {
|
||||||
|
INPUTURL: '.' + CSS.INPUTURL
|
||||||
|
},
|
||||||
ALIGNMENTS = [
|
ALIGNMENTS = [
|
||||||
// Vertical alignment.
|
// Vertical alignment.
|
||||||
{
|
{
|
||||||
@ -253,7 +256,8 @@ Y.namespace('M.atto_image').Button = Y.Base.create('button', Y.M.editor_atto.Edi
|
|||||||
var dialogue = this.getDialogue({
|
var dialogue = this.getDialogue({
|
||||||
headerContent: M.util.get_string('imageproperties', COMPONENTNAME),
|
headerContent: M.util.get_string('imageproperties', COMPONENTNAME),
|
||||||
width: '480px',
|
width: '480px',
|
||||||
focusAfterHide: true
|
focusAfterHide: true,
|
||||||
|
focusOnShowSelector: SELECTORS.INPUTURL
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set the dialogue content, and then show the dialogue.
|
// Set the dialogue content, and then show the dialogue.
|
||||||
|
@ -48,6 +48,9 @@ var CSS = {
|
|||||||
IMAGEPREVIEW: 'atto_image_preview',
|
IMAGEPREVIEW: 'atto_image_preview',
|
||||||
IMAGEPREVIEWBOX: 'atto_image_preview_box'
|
IMAGEPREVIEWBOX: 'atto_image_preview_box'
|
||||||
},
|
},
|
||||||
|
SELECTORS = {
|
||||||
|
INPUTURL: '.' + CSS.INPUTURL
|
||||||
|
},
|
||||||
ALIGNMENTS = [
|
ALIGNMENTS = [
|
||||||
// Vertical alignment.
|
// Vertical alignment.
|
||||||
{
|
{
|
||||||
@ -251,7 +254,8 @@ Y.namespace('M.atto_image').Button = Y.Base.create('button', Y.M.editor_atto.Edi
|
|||||||
var dialogue = this.getDialogue({
|
var dialogue = this.getDialogue({
|
||||||
headerContent: M.util.get_string('imageproperties', COMPONENTNAME),
|
headerContent: M.util.get_string('imageproperties', COMPONENTNAME),
|
||||||
width: '480px',
|
width: '480px',
|
||||||
focusAfterHide: true
|
focusAfterHide: true,
|
||||||
|
focusOnShowSelector: SELECTORS.INPUTURL
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set the dialogue content, and then show the dialogue.
|
// Set the dialogue content, and then show the dialogue.
|
||||||
|
@ -35,12 +35,16 @@ YUI.add('moodle-atto_link-button', function (Y, NAME) {
|
|||||||
|
|
||||||
var COMPONENTNAME = 'atto_link',
|
var COMPONENTNAME = 'atto_link',
|
||||||
CSS = {
|
CSS = {
|
||||||
NEWWINDOW: 'atto_link_openinnewwindow'
|
NEWWINDOW: 'atto_link_openinnewwindow',
|
||||||
|
URLINPUT: 'atto_link_urlentry'
|
||||||
|
},
|
||||||
|
SELECTORS = {
|
||||||
|
URLINPUT: '.atto_link_urlentry'
|
||||||
},
|
},
|
||||||
TEMPLATE = '' +
|
TEMPLATE = '' +
|
||||||
'<form class="atto_form">' +
|
'<form class="atto_form">' +
|
||||||
'<label for="{{elementid}}_atto_link_urlentry">{{get_string "enterurl" component}}</label>' +
|
'<label for="{{elementid}}_atto_link_urlentry">{{get_string "enterurl" component}}</label>' +
|
||||||
'<input class="fullwidth url" type="url" id="{{elementid}}_atto_link_urlentry" size="32"/><br/>' +
|
'<input class="fullwidth url {{CSS.URLINPUT}}" type="url" id="{{elementid}}_atto_link_urlentry" size="32"/><br/>' +
|
||||||
|
|
||||||
// Add the repository browser button.
|
// Add the repository browser button.
|
||||||
'{{#if showFilepicker}}' +
|
'{{#if showFilepicker}}' +
|
||||||
@ -111,7 +115,8 @@ Y.namespace('M.atto_link').Button = Y.Base.create('button', Y.M.editor_atto.Edit
|
|||||||
|
|
||||||
var dialogue = this.getDialogue({
|
var dialogue = this.getDialogue({
|
||||||
headerContent: M.util.get_string('createlink', COMPONENTNAME),
|
headerContent: M.util.get_string('createlink', COMPONENTNAME),
|
||||||
focusAfterHide: true
|
focusAfterHide: true,
|
||||||
|
focusOnShowSelector: SELECTORS.URLINPUT
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set the dialogue content, and then show the dialogue.
|
// Set the dialogue content, and then show the dialogue.
|
||||||
|
@ -1 +1 @@
|
|||||||
YUI.add("moodle-atto_link-button",function(e,t){var n="atto_link",r={NEWWINDOW:"atto_link_openinnewwindow"},i='<form class="atto_form"><label for="{{elementid}}_atto_link_urlentry">{{get_string "enterurl" component}}</label><input class="fullwidth url" type="url" id="{{elementid}}_atto_link_urlentry" size="32"/><br/>{{#if showFilepicker}}<button class="openlinkbrowser">{{get_string "browserepositories" component}}</button><br/>{{/if}}<input type="checkbox" class="newwindow" id="{{elementid}}_{{CSS.NEWWINDOW}}"/><label class="sameline" for="{{elementid}}_{{CSS.NEWWINDOW}}">{{get_string "openinnewwindow" component}}</label><br/><div class="mdl-align"><br/><button type="submit" class="submit">{{get_string "createlink" component}}</button></div></form>';e.namespace("M.atto_link").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{_currentSelection:null,_content:null,initializer:function(){this.addButton({icon:"e/insert_edit_link",callback:this._displayDialogue,tags:"a"}),this.addButton({buttonName:"unlink",callback:this._unlink,icon:"e/remove_link",title:"unlink",tags:"a"})},_displayDialogue:function(){this._currentSelection=this.get("host").getSelection();if(this._currentSelection===!1||this._currentSelection.collapsed)return;var e=this.getDialogue({headerContent:M.util.get_string("createlink",n),focusAfterHide:!0});e.set("bodyContent",this._getDialogueContent()),this._resolveAnchors(),e.show()},_resolveAnchors:function(){var t=this.get("host").getSelectionParentNode(),n,r,i,s;if(!t)return;n=this._findSelectedAnchors(e.one(t)),n.length>0&&(r=n[0],this._currentSelection=this.get("host").getSelectionFromNode(r),i=r.getAttribute("href"),s=r.getAttribute("target"),i!==""&&this._content.one(".url").setAttribute("value",i),s==="_blank"?this._content.one(".newwindow").setAttribute("checked","checked"):this._content.one(".newwindow").removeAttribute("checked"))},_filepickerCallback:function(e){this.getDialogue().set("focusAfterHide",null).hide(),e.url!==""&&(this.get("host").setSelection(this._currentSelection),document.execCommand("unlink",!1,null),document.execCommand("createLink",!1,e.url))},_setLink:function(t){var n,r,i,s,o,u=this.get("host");t.preventDefault(),this.getDialogue({focusAfterHide:null}).hide(),n=this._content.one(".url"),o=n.get("value");if(o!==""){this.editor.focus(),u.setSelection(this._currentSelection),document.execCommand("unlink",!1,null),document.execCommand("createLink",!1,o),i=u.getSelectionParentNode();if(!i)return;s=this._findSelectedAnchors(e.one(i)),e.Array.each(s,function(e){r=this._content.one(".newwindow"),r.get("checked")?e.setAttribute("target","_blank"):e.removeAttribute("target")},this),this.markUpdated()}},_findSelectedAnchors:function(e){var t=e.get("tagName"),n,r;return t&&t.toLowerCase()==="a"?[e]:(r=[],e.all("a").each(function(e){!n&&this.get("host").selectionContainsNode(e)&&r.push(e)},this),r.length>0?r:(n=e.ancestor("a"),n?[n]:[]))},_getDialogueContent:function(){var t=this.get("host").canShowFilepicker("link"),s=e.Handlebars.compile(i);return this._content=e.Node.create(s({showFilepicker:t,component:n,CSS:r})),this._content.one(".submit").on("click",this._setLink,this),t&&this._content.one(".openlinkbrowser").on("click",function(e){e.preventDefault(),this.get("host").showFilepicker("link",this._filepickerCallback,this)},this),this._content},_unlink:function(){var e=this.get("host"),t=e.getSelection();if(t&&t.length)if(t[0].startOffset===t[0].endOffset){var n=e.getSelectedNodes();n&&(n.each(function(t){var n=t.ancestor("a",!0);n&&(e.setSelection(e.getSelectionFromNode(n)),document.execCommand("unlink",!1,null))},this),this.markUpdated())}else document.execCommand("unlink",!1,null),this.markUpdated()}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]});
|
YUI.add("moodle-atto_link-button",function(e,t){var n="atto_link",r={NEWWINDOW:"atto_link_openinnewwindow",URLINPUT:"atto_link_urlentry"},i={URLINPUT:".atto_link_urlentry"},s='<form class="atto_form"><label for="{{elementid}}_atto_link_urlentry">{{get_string "enterurl" component}}</label><input class="fullwidth url {{CSS.URLINPUT}}" type="url" id="{{elementid}}_atto_link_urlentry" size="32"/><br/>{{#if showFilepicker}}<button class="openlinkbrowser">{{get_string "browserepositories" component}}</button><br/>{{/if}}<input type="checkbox" class="newwindow" id="{{elementid}}_{{CSS.NEWWINDOW}}"/><label class="sameline" for="{{elementid}}_{{CSS.NEWWINDOW}}">{{get_string "openinnewwindow" component}}</label><br/><div class="mdl-align"><br/><button type="submit" class="submit">{{get_string "createlink" component}}</button></div></form>';e.namespace("M.atto_link").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{_currentSelection:null,_content:null,initializer:function(){this.addButton({icon:"e/insert_edit_link",callback:this._displayDialogue,tags:"a"}),this.addButton({buttonName:"unlink",callback:this._unlink,icon:"e/remove_link",title:"unlink",tags:"a"})},_displayDialogue:function(){this._currentSelection=this.get("host").getSelection();if(this._currentSelection===!1||this._currentSelection.collapsed)return;var e=this.getDialogue({headerContent:M.util.get_string("createlink",n),focusAfterHide:!0,focusOnShowSelector:i.URLINPUT});e.set("bodyContent",this._getDialogueContent()),this._resolveAnchors(),e.show()},_resolveAnchors:function(){var t=this.get("host").getSelectionParentNode(),n,r,i,s;if(!t)return;n=this._findSelectedAnchors(e.one(t)),n.length>0&&(r=n[0],this._currentSelection=this.get("host").getSelectionFromNode(r),i=r.getAttribute("href"),s=r.getAttribute("target"),i!==""&&this._content.one(".url").setAttribute("value",i),s==="_blank"?this._content.one(".newwindow").setAttribute("checked","checked"):this._content.one(".newwindow").removeAttribute("checked"))},_filepickerCallback:function(e){this.getDialogue().set("focusAfterHide",null).hide(),e.url!==""&&(this.get("host").setSelection(this._currentSelection),document.execCommand("unlink",!1,null),document.execCommand("createLink",!1,e.url))},_setLink:function(t){var n,r,i,s,o,u=this.get("host");t.preventDefault(),this.getDialogue({focusAfterHide:null}).hide(),n=this._content.one(".url"),o=n.get("value");if(o!==""){this.editor.focus(),u.setSelection(this._currentSelection),document.execCommand("unlink",!1,null),document.execCommand("createLink",!1,o),i=u.getSelectionParentNode();if(!i)return;s=this._findSelectedAnchors(e.one(i)),e.Array.each(s,function(e){r=this._content.one(".newwindow"),r.get("checked")?e.setAttribute("target","_blank"):e.removeAttribute("target")},this),this.markUpdated()}},_findSelectedAnchors:function(e){var t=e.get("tagName"),n,r;return t&&t.toLowerCase()==="a"?[e]:(r=[],e.all("a").each(function(e){!n&&this.get("host").selectionContainsNode(e)&&r.push(e)},this),r.length>0?r:(n=e.ancestor("a"),n?[n]:[]))},_getDialogueContent:function(){var t=this.get("host").canShowFilepicker("link"),i=e.Handlebars.compile(s);return this._content=e.Node.create(i({showFilepicker:t,component:n,CSS:r})),this._content.one(".submit").on("click",this._setLink,this),t&&this._content.one(".openlinkbrowser").on("click",function(e){e.preventDefault(),this.get("host").showFilepicker("link",this._filepickerCallback,this)},this),this._content},_unlink:function(){var e=this.get("host"),t=e.getSelection();if(t&&t.length)if(t[0].startOffset===t[0].endOffset){var n=e.getSelectedNodes();n&&(n.each(function(t){var n=t.ancestor("a",!0);n&&(e.setSelection(e.getSelectionFromNode(n)),document.execCommand("unlink",!1,null))},this),this.markUpdated())}else document.execCommand("unlink",!1,null),this.markUpdated()}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]});
|
||||||
|
@ -35,12 +35,16 @@ YUI.add('moodle-atto_link-button', function (Y, NAME) {
|
|||||||
|
|
||||||
var COMPONENTNAME = 'atto_link',
|
var COMPONENTNAME = 'atto_link',
|
||||||
CSS = {
|
CSS = {
|
||||||
NEWWINDOW: 'atto_link_openinnewwindow'
|
NEWWINDOW: 'atto_link_openinnewwindow',
|
||||||
|
URLINPUT: 'atto_link_urlentry'
|
||||||
|
},
|
||||||
|
SELECTORS = {
|
||||||
|
URLINPUT: '.atto_link_urlentry'
|
||||||
},
|
},
|
||||||
TEMPLATE = '' +
|
TEMPLATE = '' +
|
||||||
'<form class="atto_form">' +
|
'<form class="atto_form">' +
|
||||||
'<label for="{{elementid}}_atto_link_urlentry">{{get_string "enterurl" component}}</label>' +
|
'<label for="{{elementid}}_atto_link_urlentry">{{get_string "enterurl" component}}</label>' +
|
||||||
'<input class="fullwidth url" type="url" id="{{elementid}}_atto_link_urlentry" size="32"/><br/>' +
|
'<input class="fullwidth url {{CSS.URLINPUT}}" type="url" id="{{elementid}}_atto_link_urlentry" size="32"/><br/>' +
|
||||||
|
|
||||||
// Add the repository browser button.
|
// Add the repository browser button.
|
||||||
'{{#if showFilepicker}}' +
|
'{{#if showFilepicker}}' +
|
||||||
@ -111,7 +115,8 @@ Y.namespace('M.atto_link').Button = Y.Base.create('button', Y.M.editor_atto.Edit
|
|||||||
|
|
||||||
var dialogue = this.getDialogue({
|
var dialogue = this.getDialogue({
|
||||||
headerContent: M.util.get_string('createlink', COMPONENTNAME),
|
headerContent: M.util.get_string('createlink', COMPONENTNAME),
|
||||||
focusAfterHide: true
|
focusAfterHide: true,
|
||||||
|
focusOnShowSelector: SELECTORS.URLINPUT
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set the dialogue content, and then show the dialogue.
|
// Set the dialogue content, and then show the dialogue.
|
||||||
|
@ -33,12 +33,16 @@
|
|||||||
|
|
||||||
var COMPONENTNAME = 'atto_link',
|
var COMPONENTNAME = 'atto_link',
|
||||||
CSS = {
|
CSS = {
|
||||||
NEWWINDOW: 'atto_link_openinnewwindow'
|
NEWWINDOW: 'atto_link_openinnewwindow',
|
||||||
|
URLINPUT: 'atto_link_urlentry'
|
||||||
|
},
|
||||||
|
SELECTORS = {
|
||||||
|
URLINPUT: '.atto_link_urlentry'
|
||||||
},
|
},
|
||||||
TEMPLATE = '' +
|
TEMPLATE = '' +
|
||||||
'<form class="atto_form">' +
|
'<form class="atto_form">' +
|
||||||
'<label for="{{elementid}}_atto_link_urlentry">{{get_string "enterurl" component}}</label>' +
|
'<label for="{{elementid}}_atto_link_urlentry">{{get_string "enterurl" component}}</label>' +
|
||||||
'<input class="fullwidth url" type="url" id="{{elementid}}_atto_link_urlentry" size="32"/><br/>' +
|
'<input class="fullwidth url {{CSS.URLINPUT}}" type="url" id="{{elementid}}_atto_link_urlentry" size="32"/><br/>' +
|
||||||
|
|
||||||
// Add the repository browser button.
|
// Add the repository browser button.
|
||||||
'{{#if showFilepicker}}' +
|
'{{#if showFilepicker}}' +
|
||||||
@ -109,7 +113,8 @@ Y.namespace('M.atto_link').Button = Y.Base.create('button', Y.M.editor_atto.Edit
|
|||||||
|
|
||||||
var dialogue = this.getDialogue({
|
var dialogue = this.getDialogue({
|
||||||
headerContent: M.util.get_string('createlink', COMPONENTNAME),
|
headerContent: M.util.get_string('createlink', COMPONENTNAME),
|
||||||
focusAfterHide: true
|
focusAfterHide: true,
|
||||||
|
focusOnShowSelector: SELECTORS.URLINPUT
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set the dialogue content, and then show the dialogue.
|
// Set the dialogue content, and then show the dialogue.
|
||||||
|
@ -34,13 +34,21 @@ YUI.add('moodle-atto_media-button', function (Y, NAME) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
var COMPONENTNAME = 'atto_media',
|
var COMPONENTNAME = 'atto_media',
|
||||||
|
CSS = {
|
||||||
|
URLINPUT: 'atto_media_urlentry',
|
||||||
|
NAMEINPUT: 'atto_media_nameentry'
|
||||||
|
},
|
||||||
|
SELECTORS = {
|
||||||
|
URLINPUT: '.' + CSS.URLINPUT,
|
||||||
|
NAMEINPUT: '.' + CSS.NAMEINPUT
|
||||||
|
},
|
||||||
TEMPLATE = '' +
|
TEMPLATE = '' +
|
||||||
'<form class="atto_form">' +
|
'<form class="atto_form">' +
|
||||||
'<label for="{{elementid}}_atto_media_urlentry">{{get_string "enterurl" component}}</label>' +
|
'<label for="{{elementid}}_atto_media_urlentry">{{get_string "enterurl" component}}</label>' +
|
||||||
'<input class="fullwidth urlentry" type="url" id="{{elementid}}_atto_media_urlentry" size="32"/><br/>' +
|
'<input class="fullwidth {{CSS.URLINPUT}}" type="url" id="{{elementid}}_atto_media_urlentry" size="32"/><br/>' +
|
||||||
'<button class="openmediabrowser" type="button">{{get_string "browserepositories" component}}</button>' +
|
'<button class="openmediabrowser" type="button">{{get_string "browserepositories" component}}</button>' +
|
||||||
'<label for="{{elementid}}_atto_media_nameentry">{{get_string "entername" component}}</label>' +
|
'<label for="{{elementid}}_atto_media_nameentry">{{get_string "entername" component}}</label>' +
|
||||||
'<input class="fullwidth nameentry" type="text" id="{{elementid}}_atto_media_nameentry" size="32" required="true"/>' +
|
'<input class="fullwidth {{CSS.NAMEINPUT}}" type="text" id="{{elementid}}_atto_media_nameentry" size="32" required="true"/>' +
|
||||||
'<div class="mdl-align">' +
|
'<div class="mdl-align">' +
|
||||||
'<br/>' +
|
'<br/>' +
|
||||||
'<button class="submit" type="submit">{{get_string "createmedia" component}}</button>' +
|
'<button class="submit" type="submit">{{get_string "createmedia" component}}</button>' +
|
||||||
@ -92,7 +100,8 @@ Y.namespace('M.atto_media').Button = Y.Base.create('button', Y.M.editor_atto.Edi
|
|||||||
|
|
||||||
var dialogue = this.getDialogue({
|
var dialogue = this.getDialogue({
|
||||||
headerContent: M.util.get_string('createmedia', COMPONENTNAME),
|
headerContent: M.util.get_string('createmedia', COMPONENTNAME),
|
||||||
focusAfterHide: true
|
focusAfterHide: true,
|
||||||
|
focusOnShowSelector: SELECTORS.URLINPUT
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set the dialogue content, and then show the dialogue.
|
// Set the dialogue content, and then show the dialogue.
|
||||||
@ -113,7 +122,8 @@ Y.namespace('M.atto_media').Button = Y.Base.create('button', Y.M.editor_atto.Edi
|
|||||||
|
|
||||||
this._content = Y.Node.create(template({
|
this._content = Y.Node.create(template({
|
||||||
component: COMPONENTNAME,
|
component: COMPONENTNAME,
|
||||||
elementid: this.get('host').get('elementid')
|
elementid: this.get('host').get('elementid'),
|
||||||
|
CSS: CSS
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this._content.one('.submit').on('click', this._setMedia, this);
|
this._content.one('.submit').on('click', this._setMedia, this);
|
||||||
@ -135,9 +145,9 @@ Y.namespace('M.atto_media').Button = Y.Base.create('button', Y.M.editor_atto.Edi
|
|||||||
*/
|
*/
|
||||||
_filepickerCallback: function(params) {
|
_filepickerCallback: function(params) {
|
||||||
if (params.url !== '') {
|
if (params.url !== '') {
|
||||||
this._content.one('.urlentry')
|
this._content.one(SELECTORS.URLINPUT)
|
||||||
.set('value', params.url);
|
.set('value', params.url);
|
||||||
this._content.one('.nameentry')
|
this._content.one(SELECTORS.NAMEINPUT)
|
||||||
.set('value', params.file);
|
.set('value', params.file);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -156,8 +166,8 @@ Y.namespace('M.atto_media').Button = Y.Base.create('button', Y.M.editor_atto.Edi
|
|||||||
}).hide();
|
}).hide();
|
||||||
|
|
||||||
var form = e.currentTarget.ancestor('.atto_form'),
|
var form = e.currentTarget.ancestor('.atto_form'),
|
||||||
url = form.one('.urlentry').get('value'),
|
url = form.one(SELECTORS.URLINPUT).get('value'),
|
||||||
name = form.one('.nameentry').get('value'),
|
name = form.one(SELECTORS.NAMEINPUT).get('value'),
|
||||||
host = this.get('host');
|
host = this.get('host');
|
||||||
|
|
||||||
if (url !== '' && name !== '') {
|
if (url !== '' && name !== '') {
|
||||||
|
@ -1 +1 @@
|
|||||||
YUI.add("moodle-atto_media-button",function(e,t){var n="atto_media",r='<form class="atto_form"><label for="{{elementid}}_atto_media_urlentry">{{get_string "enterurl" component}}</label><input class="fullwidth urlentry" type="url" id="{{elementid}}_atto_media_urlentry" size="32"/><br/><button class="openmediabrowser" type="button">{{get_string "browserepositories" component}}</button><label for="{{elementid}}_atto_media_nameentry">{{get_string "entername" component}}</label><input class="fullwidth nameentry" type="text" id="{{elementid}}_atto_media_nameentry" size="32" required="true"/><div class="mdl-align"><br/><button class="submit" type="submit">{{get_string "createmedia" component}}</button></div></form>';e.namespace("M.atto_media").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{_currentSelection:null,_content:null,initializer:function(){this.get("host").canShowFilepicker("media")&&this.addButton({icon:"e/insert_edit_video",callback:this._displayDialogue})},_displayDialogue:function(){this._currentSelection=this.get("host").getSelection();if(this._currentSelection===!1)return;var e=this.getDialogue({headerContent:M.util.get_string("createmedia",n),focusAfterHide:!0});e.set("bodyContent",this._getDialogueContent()).show()},_getDialogueContent:function(){var t=e.Handlebars.compile(r);return this._content=e.Node.create(t({component:n,elementid:this.get("host").get("elementid")})),this._content.one(".submit").on("click",this._setMedia,this),this._content.one(".openmediabrowser").on("click",function(e){e.preventDefault(),this.get("host").showFilepicker("media",this._filepickerCallback,this)},this),this._content},_filepickerCallback:function(e){e.url!==""&&(this._content.one(".urlentry").set("value",e.url),this._content.one(".nameentry").set("value",e.file))},_setMedia:function(t){t.preventDefault(),this.getDialogue({focusAfterHide:null}).hide();var n=t.currentTarget.ancestor(".atto_form"),r=n.one(".urlentry").get("value"),i=n.one(".nameentry").get("value"),s=this.get("host");if(r!==""&&i!==""){s.setSelection(this._currentSelection);var o='<a href="'+e.Escape.html(r)+'">'+i+"</a>";s.insertContentAtFocusPoint(o),this.markUpdated()}}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]});
|
YUI.add("moodle-atto_media-button",function(e,t){var n="atto_media",r={URLINPUT:"atto_media_urlentry",NAMEINPUT:"atto_media_nameentry"},i={URLINPUT:"."+r.URLINPUT,NAMEINPUT:"."+r.NAMEINPUT},s='<form class="atto_form"><label for="{{elementid}}_atto_media_urlentry">{{get_string "enterurl" component}}</label><input class="fullwidth {{CSS.URLINPUT}}" type="url" id="{{elementid}}_atto_media_urlentry" size="32"/><br/><button class="openmediabrowser" type="button">{{get_string "browserepositories" component}}</button><label for="{{elementid}}_atto_media_nameentry">{{get_string "entername" component}}</label><input class="fullwidth {{CSS.NAMEINPUT}}" type="text" id="{{elementid}}_atto_media_nameentry" size="32" required="true"/><div class="mdl-align"><br/><button class="submit" type="submit">{{get_string "createmedia" component}}</button></div></form>';e.namespace("M.atto_media").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{_currentSelection:null,_content:null,initializer:function(){this.get("host").canShowFilepicker("media")&&this.addButton({icon:"e/insert_edit_video",callback:this._displayDialogue})},_displayDialogue:function(){this._currentSelection=this.get("host").getSelection();if(this._currentSelection===!1)return;var e=this.getDialogue({headerContent:M.util.get_string("createmedia",n),focusAfterHide:!0,focusOnShowSelector:i.URLINPUT});e.set("bodyContent",this._getDialogueContent()).show()},_getDialogueContent:function(){var t=e.Handlebars.compile(s);return this._content=e.Node.create(t({component:n,elementid:this.get("host").get("elementid"),CSS:r})),this._content.one(".submit").on("click",this._setMedia,this),this._content.one(".openmediabrowser").on("click",function(e){e.preventDefault(),this.get("host").showFilepicker("media",this._filepickerCallback,this)},this),this._content},_filepickerCallback:function(e){e.url!==""&&(this._content.one(i.URLINPUT).set("value",e.url),this._content.one(i.NAMEINPUT).set("value",e.file))},_setMedia:function(t){t.preventDefault(),this.getDialogue({focusAfterHide:null}).hide();var n=t.currentTarget.ancestor(".atto_form"),r=n.one(i.URLINPUT).get("value"),s=n.one(i.NAMEINPUT).get("value"),o=this.get("host");if(r!==""&&s!==""){o.setSelection(this._currentSelection);var u='<a href="'+e.Escape.html(r)+'">'+s+"</a>";o.insertContentAtFocusPoint(u),this.markUpdated()}}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]});
|
||||||
|
@ -34,13 +34,21 @@ YUI.add('moodle-atto_media-button', function (Y, NAME) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
var COMPONENTNAME = 'atto_media',
|
var COMPONENTNAME = 'atto_media',
|
||||||
|
CSS = {
|
||||||
|
URLINPUT: 'atto_media_urlentry',
|
||||||
|
NAMEINPUT: 'atto_media_nameentry'
|
||||||
|
},
|
||||||
|
SELECTORS = {
|
||||||
|
URLINPUT: '.' + CSS.URLINPUT,
|
||||||
|
NAMEINPUT: '.' + CSS.NAMEINPUT
|
||||||
|
},
|
||||||
TEMPLATE = '' +
|
TEMPLATE = '' +
|
||||||
'<form class="atto_form">' +
|
'<form class="atto_form">' +
|
||||||
'<label for="{{elementid}}_atto_media_urlentry">{{get_string "enterurl" component}}</label>' +
|
'<label for="{{elementid}}_atto_media_urlentry">{{get_string "enterurl" component}}</label>' +
|
||||||
'<input class="fullwidth urlentry" type="url" id="{{elementid}}_atto_media_urlentry" size="32"/><br/>' +
|
'<input class="fullwidth {{CSS.URLINPUT}}" type="url" id="{{elementid}}_atto_media_urlentry" size="32"/><br/>' +
|
||||||
'<button class="openmediabrowser" type="button">{{get_string "browserepositories" component}}</button>' +
|
'<button class="openmediabrowser" type="button">{{get_string "browserepositories" component}}</button>' +
|
||||||
'<label for="{{elementid}}_atto_media_nameentry">{{get_string "entername" component}}</label>' +
|
'<label for="{{elementid}}_atto_media_nameentry">{{get_string "entername" component}}</label>' +
|
||||||
'<input class="fullwidth nameentry" type="text" id="{{elementid}}_atto_media_nameentry" size="32" required="true"/>' +
|
'<input class="fullwidth {{CSS.NAMEINPUT}}" type="text" id="{{elementid}}_atto_media_nameentry" size="32" required="true"/>' +
|
||||||
'<div class="mdl-align">' +
|
'<div class="mdl-align">' +
|
||||||
'<br/>' +
|
'<br/>' +
|
||||||
'<button class="submit" type="submit">{{get_string "createmedia" component}}</button>' +
|
'<button class="submit" type="submit">{{get_string "createmedia" component}}</button>' +
|
||||||
@ -92,7 +100,8 @@ Y.namespace('M.atto_media').Button = Y.Base.create('button', Y.M.editor_atto.Edi
|
|||||||
|
|
||||||
var dialogue = this.getDialogue({
|
var dialogue = this.getDialogue({
|
||||||
headerContent: M.util.get_string('createmedia', COMPONENTNAME),
|
headerContent: M.util.get_string('createmedia', COMPONENTNAME),
|
||||||
focusAfterHide: true
|
focusAfterHide: true,
|
||||||
|
focusOnShowSelector: SELECTORS.URLINPUT
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set the dialogue content, and then show the dialogue.
|
// Set the dialogue content, and then show the dialogue.
|
||||||
@ -113,7 +122,8 @@ Y.namespace('M.atto_media').Button = Y.Base.create('button', Y.M.editor_atto.Edi
|
|||||||
|
|
||||||
this._content = Y.Node.create(template({
|
this._content = Y.Node.create(template({
|
||||||
component: COMPONENTNAME,
|
component: COMPONENTNAME,
|
||||||
elementid: this.get('host').get('elementid')
|
elementid: this.get('host').get('elementid'),
|
||||||
|
CSS: CSS
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this._content.one('.submit').on('click', this._setMedia, this);
|
this._content.one('.submit').on('click', this._setMedia, this);
|
||||||
@ -135,9 +145,9 @@ Y.namespace('M.atto_media').Button = Y.Base.create('button', Y.M.editor_atto.Edi
|
|||||||
*/
|
*/
|
||||||
_filepickerCallback: function(params) {
|
_filepickerCallback: function(params) {
|
||||||
if (params.url !== '') {
|
if (params.url !== '') {
|
||||||
this._content.one('.urlentry')
|
this._content.one(SELECTORS.URLINPUT)
|
||||||
.set('value', params.url);
|
.set('value', params.url);
|
||||||
this._content.one('.nameentry')
|
this._content.one(SELECTORS.NAMEINPUT)
|
||||||
.set('value', params.file);
|
.set('value', params.file);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -156,8 +166,8 @@ Y.namespace('M.atto_media').Button = Y.Base.create('button', Y.M.editor_atto.Edi
|
|||||||
}).hide();
|
}).hide();
|
||||||
|
|
||||||
var form = e.currentTarget.ancestor('.atto_form'),
|
var form = e.currentTarget.ancestor('.atto_form'),
|
||||||
url = form.one('.urlentry').get('value'),
|
url = form.one(SELECTORS.URLINPUT).get('value'),
|
||||||
name = form.one('.nameentry').get('value'),
|
name = form.one(SELECTORS.NAMEINPUT).get('value'),
|
||||||
host = this.get('host');
|
host = this.get('host');
|
||||||
|
|
||||||
if (url !== '' && name !== '') {
|
if (url !== '' && name !== '') {
|
||||||
|
@ -32,13 +32,21 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
var COMPONENTNAME = 'atto_media',
|
var COMPONENTNAME = 'atto_media',
|
||||||
|
CSS = {
|
||||||
|
URLINPUT: 'atto_media_urlentry',
|
||||||
|
NAMEINPUT: 'atto_media_nameentry'
|
||||||
|
},
|
||||||
|
SELECTORS = {
|
||||||
|
URLINPUT: '.' + CSS.URLINPUT,
|
||||||
|
NAMEINPUT: '.' + CSS.NAMEINPUT
|
||||||
|
},
|
||||||
TEMPLATE = '' +
|
TEMPLATE = '' +
|
||||||
'<form class="atto_form">' +
|
'<form class="atto_form">' +
|
||||||
'<label for="{{elementid}}_atto_media_urlentry">{{get_string "enterurl" component}}</label>' +
|
'<label for="{{elementid}}_atto_media_urlentry">{{get_string "enterurl" component}}</label>' +
|
||||||
'<input class="fullwidth urlentry" type="url" id="{{elementid}}_atto_media_urlentry" size="32"/><br/>' +
|
'<input class="fullwidth {{CSS.URLINPUT}}" type="url" id="{{elementid}}_atto_media_urlentry" size="32"/><br/>' +
|
||||||
'<button class="openmediabrowser" type="button">{{get_string "browserepositories" component}}</button>' +
|
'<button class="openmediabrowser" type="button">{{get_string "browserepositories" component}}</button>' +
|
||||||
'<label for="{{elementid}}_atto_media_nameentry">{{get_string "entername" component}}</label>' +
|
'<label for="{{elementid}}_atto_media_nameentry">{{get_string "entername" component}}</label>' +
|
||||||
'<input class="fullwidth nameentry" type="text" id="{{elementid}}_atto_media_nameentry" size="32" required="true"/>' +
|
'<input class="fullwidth {{CSS.NAMEINPUT}}" type="text" id="{{elementid}}_atto_media_nameentry" size="32" required="true"/>' +
|
||||||
'<div class="mdl-align">' +
|
'<div class="mdl-align">' +
|
||||||
'<br/>' +
|
'<br/>' +
|
||||||
'<button class="submit" type="submit">{{get_string "createmedia" component}}</button>' +
|
'<button class="submit" type="submit">{{get_string "createmedia" component}}</button>' +
|
||||||
@ -90,7 +98,8 @@ Y.namespace('M.atto_media').Button = Y.Base.create('button', Y.M.editor_atto.Edi
|
|||||||
|
|
||||||
var dialogue = this.getDialogue({
|
var dialogue = this.getDialogue({
|
||||||
headerContent: M.util.get_string('createmedia', COMPONENTNAME),
|
headerContent: M.util.get_string('createmedia', COMPONENTNAME),
|
||||||
focusAfterHide: true
|
focusAfterHide: true,
|
||||||
|
focusOnShowSelector: SELECTORS.URLINPUT
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set the dialogue content, and then show the dialogue.
|
// Set the dialogue content, and then show the dialogue.
|
||||||
@ -111,7 +120,8 @@ Y.namespace('M.atto_media').Button = Y.Base.create('button', Y.M.editor_atto.Edi
|
|||||||
|
|
||||||
this._content = Y.Node.create(template({
|
this._content = Y.Node.create(template({
|
||||||
component: COMPONENTNAME,
|
component: COMPONENTNAME,
|
||||||
elementid: this.get('host').get('elementid')
|
elementid: this.get('host').get('elementid'),
|
||||||
|
CSS: CSS
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this._content.one('.submit').on('click', this._setMedia, this);
|
this._content.one('.submit').on('click', this._setMedia, this);
|
||||||
@ -133,9 +143,9 @@ Y.namespace('M.atto_media').Button = Y.Base.create('button', Y.M.editor_atto.Edi
|
|||||||
*/
|
*/
|
||||||
_filepickerCallback: function(params) {
|
_filepickerCallback: function(params) {
|
||||||
if (params.url !== '') {
|
if (params.url !== '') {
|
||||||
this._content.one('.urlentry')
|
this._content.one(SELECTORS.URLINPUT)
|
||||||
.set('value', params.url);
|
.set('value', params.url);
|
||||||
this._content.one('.nameentry')
|
this._content.one(SELECTORS.NAMEINPUT)
|
||||||
.set('value', params.file);
|
.set('value', params.file);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -154,8 +164,8 @@ Y.namespace('M.atto_media').Button = Y.Base.create('button', Y.M.editor_atto.Edi
|
|||||||
}).hide();
|
}).hide();
|
||||||
|
|
||||||
var form = e.currentTarget.ancestor('.atto_form'),
|
var form = e.currentTarget.ancestor('.atto_form'),
|
||||||
url = form.one('.urlentry').get('value'),
|
url = form.one(SELECTORS.URLINPUT).get('value'),
|
||||||
name = form.one('.nameentry').get('value'),
|
name = form.one(SELECTORS.NAMEINPUT).get('value'),
|
||||||
host = this.get('host');
|
host = this.get('host');
|
||||||
|
|
||||||
if (url !== '' && name !== '') {
|
if (url !== '' && name !== '') {
|
||||||
|
@ -159,7 +159,8 @@ Y.namespace('M.atto_table').Button = Y.Base.create('button', Y.M.editor_atto.Edi
|
|||||||
if (this._currentSelection !== false && (!this._currentSelection.collapsed)) {
|
if (this._currentSelection !== false && (!this._currentSelection.collapsed)) {
|
||||||
var dialogue = this.getDialogue({
|
var dialogue = this.getDialogue({
|
||||||
headerContent: M.util.get_string('createtable', COMPONENT),
|
headerContent: M.util.get_string('createtable', COMPONENT),
|
||||||
focusAfterHide: true
|
focusAfterHide: true,
|
||||||
|
focusOnShowSelector: SELECTORS.CAPTION
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set the dialogue content, and then show the dialogue.
|
// Set the dialogue content, and then show the dialogue.
|
||||||
@ -879,7 +880,8 @@ Y.namespace('M.atto_table').Button = Y.Base.create('button', Y.M.editor_atto.Edi
|
|||||||
_editTable: function() {
|
_editTable: function() {
|
||||||
var dialogue = this.getDialogue({
|
var dialogue = this.getDialogue({
|
||||||
headerContent: M.util.get_string('edittable', COMPONENT),
|
headerContent: M.util.get_string('edittable', COMPONENT),
|
||||||
focusAfterHide: false
|
focusAfterHide: false,
|
||||||
|
focusOnShowSelector: SELECTORS.CAPTION
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set the dialogue content, and then show the dialogue.
|
// Set the dialogue content, and then show the dialogue.
|
||||||
|
File diff suppressed because one or more lines are too long
@ -159,7 +159,8 @@ Y.namespace('M.atto_table').Button = Y.Base.create('button', Y.M.editor_atto.Edi
|
|||||||
if (this._currentSelection !== false && (!this._currentSelection.collapsed)) {
|
if (this._currentSelection !== false && (!this._currentSelection.collapsed)) {
|
||||||
var dialogue = this.getDialogue({
|
var dialogue = this.getDialogue({
|
||||||
headerContent: M.util.get_string('createtable', COMPONENT),
|
headerContent: M.util.get_string('createtable', COMPONENT),
|
||||||
focusAfterHide: true
|
focusAfterHide: true,
|
||||||
|
focusOnShowSelector: SELECTORS.CAPTION
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set the dialogue content, and then show the dialogue.
|
// Set the dialogue content, and then show the dialogue.
|
||||||
@ -879,7 +880,8 @@ Y.namespace('M.atto_table').Button = Y.Base.create('button', Y.M.editor_atto.Edi
|
|||||||
_editTable: function() {
|
_editTable: function() {
|
||||||
var dialogue = this.getDialogue({
|
var dialogue = this.getDialogue({
|
||||||
headerContent: M.util.get_string('edittable', COMPONENT),
|
headerContent: M.util.get_string('edittable', COMPONENT),
|
||||||
focusAfterHide: false
|
focusAfterHide: false,
|
||||||
|
focusOnShowSelector: SELECTORS.CAPTION
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set the dialogue content, and then show the dialogue.
|
// Set the dialogue content, and then show the dialogue.
|
||||||
|
@ -157,7 +157,8 @@ Y.namespace('M.atto_table').Button = Y.Base.create('button', Y.M.editor_atto.Edi
|
|||||||
if (this._currentSelection !== false && (!this._currentSelection.collapsed)) {
|
if (this._currentSelection !== false && (!this._currentSelection.collapsed)) {
|
||||||
var dialogue = this.getDialogue({
|
var dialogue = this.getDialogue({
|
||||||
headerContent: M.util.get_string('createtable', COMPONENT),
|
headerContent: M.util.get_string('createtable', COMPONENT),
|
||||||
focusAfterHide: true
|
focusAfterHide: true,
|
||||||
|
focusOnShowSelector: SELECTORS.CAPTION
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set the dialogue content, and then show the dialogue.
|
// Set the dialogue content, and then show the dialogue.
|
||||||
@ -877,7 +878,8 @@ Y.namespace('M.atto_table').Button = Y.Base.create('button', Y.M.editor_atto.Edi
|
|||||||
_editTable: function() {
|
_editTable: function() {
|
||||||
var dialogue = this.getDialogue({
|
var dialogue = this.getDialogue({
|
||||||
headerContent: M.util.get_string('edittable', COMPONENT),
|
headerContent: M.util.get_string('edittable', COMPONENT),
|
||||||
focusAfterHide: false
|
focusAfterHide: false,
|
||||||
|
focusOnShowSelector: SELECTORS.CAPTION
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set the dialogue content, and then show the dialogue.
|
// Set the dialogue content, and then show the dialogue.
|
||||||
|
@ -312,7 +312,9 @@ Y.extend(DIALOGUE, Y.Panel, {
|
|||||||
show : function() {
|
show : function() {
|
||||||
var result = null,
|
var result = null,
|
||||||
header = this.headerNode,
|
header = this.headerNode,
|
||||||
content = this.bodyNode;
|
content = this.bodyNode,
|
||||||
|
focusSelector = this.get('focusOnShowSelector'),
|
||||||
|
focusNode = null;
|
||||||
|
|
||||||
result = DIALOGUE.superclass.show.call(this);
|
result = DIALOGUE.superclass.show.call(this);
|
||||||
|
|
||||||
@ -323,10 +325,20 @@ Y.extend(DIALOGUE, Y.Panel, {
|
|||||||
this.lockScroll.enableScrollLock(this.shouldResizeFullscreen());
|
this.lockScroll.enableScrollLock(this.shouldResizeFullscreen());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (header && header !== '') {
|
// Try and find a node to focus on using the focusOnShowSelector attribute.
|
||||||
header.focus();
|
if (focusSelector !== null) {
|
||||||
} else if (content && content !== '') {
|
focusNode = this.get('boundingBox').one(focusSelector);
|
||||||
content.focus();
|
}
|
||||||
|
if (!focusNode) {
|
||||||
|
// Fall back to the header or the content if no focus node was found yet.
|
||||||
|
if (header && header !== '') {
|
||||||
|
focusNode = header;
|
||||||
|
} else if (content && content !== '') {
|
||||||
|
focusNode = content;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (focusNode) {
|
||||||
|
focusNode.focus();
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
@ -494,7 +506,21 @@ Y.extend(DIALOGUE, Y.Panel, {
|
|||||||
*/
|
*/
|
||||||
responsiveWidth : {
|
responsiveWidth : {
|
||||||
value : 768
|
value : 768
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selector to a node that should recieve focus when this dialogue is shown.
|
||||||
|
*
|
||||||
|
* The default behaviour is to focus on the header.
|
||||||
|
*
|
||||||
|
* @attribute focusOnShowSelector
|
||||||
|
* @default null
|
||||||
|
* @type String
|
||||||
|
*/
|
||||||
|
focusOnShowSelector: {
|
||||||
|
value: null
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
@ -312,7 +312,9 @@ Y.extend(DIALOGUE, Y.Panel, {
|
|||||||
show : function() {
|
show : function() {
|
||||||
var result = null,
|
var result = null,
|
||||||
header = this.headerNode,
|
header = this.headerNode,
|
||||||
content = this.bodyNode;
|
content = this.bodyNode,
|
||||||
|
focusSelector = this.get('focusOnShowSelector'),
|
||||||
|
focusNode = null;
|
||||||
|
|
||||||
result = DIALOGUE.superclass.show.call(this);
|
result = DIALOGUE.superclass.show.call(this);
|
||||||
|
|
||||||
@ -323,10 +325,20 @@ Y.extend(DIALOGUE, Y.Panel, {
|
|||||||
this.lockScroll.enableScrollLock(this.shouldResizeFullscreen());
|
this.lockScroll.enableScrollLock(this.shouldResizeFullscreen());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (header && header !== '') {
|
// Try and find a node to focus on using the focusOnShowSelector attribute.
|
||||||
header.focus();
|
if (focusSelector !== null) {
|
||||||
} else if (content && content !== '') {
|
focusNode = this.get('boundingBox').one(focusSelector);
|
||||||
content.focus();
|
}
|
||||||
|
if (!focusNode) {
|
||||||
|
// Fall back to the header or the content if no focus node was found yet.
|
||||||
|
if (header && header !== '') {
|
||||||
|
focusNode = header;
|
||||||
|
} else if (content && content !== '') {
|
||||||
|
focusNode = content;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (focusNode) {
|
||||||
|
focusNode.focus();
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
@ -492,7 +504,21 @@ Y.extend(DIALOGUE, Y.Panel, {
|
|||||||
*/
|
*/
|
||||||
responsiveWidth : {
|
responsiveWidth : {
|
||||||
value : 768
|
value : 768
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selector to a node that should recieve focus when this dialogue is shown.
|
||||||
|
*
|
||||||
|
* The default behaviour is to focus on the header.
|
||||||
|
*
|
||||||
|
* @attribute focusOnShowSelector
|
||||||
|
* @default null
|
||||||
|
* @type String
|
||||||
|
*/
|
||||||
|
focusOnShowSelector: {
|
||||||
|
value: null
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
36
lib/yui/src/notification/js/dialogue.js
vendored
36
lib/yui/src/notification/js/dialogue.js
vendored
@ -283,7 +283,9 @@ Y.extend(DIALOGUE, Y.Panel, {
|
|||||||
show : function() {
|
show : function() {
|
||||||
var result = null,
|
var result = null,
|
||||||
header = this.headerNode,
|
header = this.headerNode,
|
||||||
content = this.bodyNode;
|
content = this.bodyNode,
|
||||||
|
focusSelector = this.get('focusOnShowSelector'),
|
||||||
|
focusNode = null;
|
||||||
|
|
||||||
result = DIALOGUE.superclass.show.call(this);
|
result = DIALOGUE.superclass.show.call(this);
|
||||||
|
|
||||||
@ -294,10 +296,20 @@ Y.extend(DIALOGUE, Y.Panel, {
|
|||||||
this.lockScroll.enableScrollLock(this.shouldResizeFullscreen());
|
this.lockScroll.enableScrollLock(this.shouldResizeFullscreen());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (header && header !== '') {
|
// Try and find a node to focus on using the focusOnShowSelector attribute.
|
||||||
header.focus();
|
if (focusSelector !== null) {
|
||||||
} else if (content && content !== '') {
|
focusNode = this.get('boundingBox').one(focusSelector);
|
||||||
content.focus();
|
}
|
||||||
|
if (!focusNode) {
|
||||||
|
// Fall back to the header or the content if no focus node was found yet.
|
||||||
|
if (header && header !== '') {
|
||||||
|
focusNode = header;
|
||||||
|
} else if (content && content !== '') {
|
||||||
|
focusNode = content;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (focusNode) {
|
||||||
|
focusNode.focus();
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
@ -465,7 +477,21 @@ Y.extend(DIALOGUE, Y.Panel, {
|
|||||||
*/
|
*/
|
||||||
responsiveWidth : {
|
responsiveWidth : {
|
||||||
value : 768
|
value : 768
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selector to a node that should recieve focus when this dialogue is shown.
|
||||||
|
*
|
||||||
|
* The default behaviour is to focus on the header.
|
||||||
|
*
|
||||||
|
* @attribute focusOnShowSelector
|
||||||
|
* @default null
|
||||||
|
* @type String
|
||||||
|
*/
|
||||||
|
focusOnShowSelector: {
|
||||||
|
value: null
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user