MDL-44972 Atto dialogues: Change M.core.dialogue attribute name to "focusOnShowSelector"

And some minor cleanups.
This commit is contained in:
Damyon Wiese
2014-05-05 16:27:36 +08:00
parent e5ddec38cd
commit c1660772b1
24 changed files with 117 additions and 102 deletions
@@ -210,7 +210,7 @@ Y.namespace('M.atto_equation').Button = Y.Base.create('button', Y.M.editor_atto.
headerContent: M.util.get_string('pluginname', COMPONENTNAME),
focusAfterHide: true,
width: 600,
focusSelector: SELECTORS.EQUATION_TEXT
focusOnShowSelector: SELECTORS.EQUATION_TEXT
});
var content = this._getDialogueContent();
File diff suppressed because one or more lines are too long
@@ -210,7 +210,7 @@ Y.namespace('M.atto_equation').Button = Y.Base.create('button', Y.M.editor_atto.
headerContent: M.util.get_string('pluginname', COMPONENTNAME),
focusAfterHide: true,
width: 600,
focusSelector: SELECTORS.EQUATION_TEXT
focusOnShowSelector: SELECTORS.EQUATION_TEXT
});
var content = this._getDialogueContent();
@@ -208,7 +208,7 @@ Y.namespace('M.atto_equation').Button = Y.Base.create('button', Y.M.editor_atto.
headerContent: M.util.get_string('pluginname', COMPONENTNAME),
focusAfterHide: true,
width: 600,
focusSelector: SELECTORS.EQUATION_TEXT
focusOnShowSelector: SELECTORS.EQUATION_TEXT
});
var content = this._getDialogueContent();
@@ -257,7 +257,7 @@ Y.namespace('M.atto_image').Button = Y.Base.create('button', Y.M.editor_atto.Edi
headerContent: M.util.get_string('imageproperties', COMPONENTNAME),
width: '480px',
focusAfterHide: true,
focusSelector: SELECTORS.INPUTURL
focusOnShowSelector: SELECTORS.INPUTURL
});
// Set the dialogue content, and then show the dialogue.
File diff suppressed because one or more lines are too long
@@ -257,7 +257,7 @@ Y.namespace('M.atto_image').Button = Y.Base.create('button', Y.M.editor_atto.Edi
headerContent: M.util.get_string('imageproperties', COMPONENTNAME),
width: '480px',
focusAfterHide: true,
focusSelector: SELECTORS.INPUTURL
focusOnShowSelector: SELECTORS.INPUTURL
});
// Set the dialogue content, and then show the dialogue.
+1 -1
View File
@@ -255,7 +255,7 @@ Y.namespace('M.atto_image').Button = Y.Base.create('button', Y.M.editor_atto.Edi
headerContent: M.util.get_string('imageproperties', COMPONENTNAME),
width: '480px',
focusAfterHide: true,
focusSelector: SELECTORS.INPUTURL
focusOnShowSelector: SELECTORS.INPUTURL
});
// Set the dialogue content, and then show the dialogue.
@@ -116,7 +116,7 @@ Y.namespace('M.atto_link').Button = Y.Base.create('button', Y.M.editor_atto.Edit
var dialogue = this.getDialogue({
headerContent: M.util.get_string('createlink', COMPONENTNAME),
focusAfterHide: true,
focusSelector: SELECTORS.URLINPUT
focusOnShowSelector: SELECTORS.URLINPUT
});
// 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",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,focusSelector: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"]});
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"]});
@@ -116,7 +116,7 @@ Y.namespace('M.atto_link').Button = Y.Base.create('button', Y.M.editor_atto.Edit
var dialogue = this.getDialogue({
headerContent: M.util.get_string('createlink', COMPONENTNAME),
focusAfterHide: true,
focusSelector: SELECTORS.URLINPUT
focusOnShowSelector: SELECTORS.URLINPUT
});
// Set the dialogue content, and then show the dialogue.
+1 -1
View File
@@ -114,7 +114,7 @@ Y.namespace('M.atto_link').Button = Y.Base.create('button', Y.M.editor_atto.Edit
var dialogue = this.getDialogue({
headerContent: M.util.get_string('createlink', COMPONENTNAME),
focusAfterHide: true,
focusSelector: SELECTORS.URLINPUT
focusOnShowSelector: SELECTORS.URLINPUT
});
// Set the dialogue content, and then show the dialogue.
@@ -35,10 +35,12 @@ YUI.add('moodle-atto_media-button', function (Y, NAME) {
var COMPONENTNAME = 'atto_media',
CSS = {
URLINPUT: 'urlentry'
URLINPUT: 'atto_media_urlentry',
NAMEINPUT: 'atto_media_nameentry'
},
SELECTORS = {
URLINPUT: '.' + CSS.URLINPUT
URLINPUT: '.' + CSS.URLINPUT,
NAMEINPUT: '.' + CSS.NAMEINPUT
},
TEMPLATE = '' +
'<form class="atto_form">' +
@@ -46,7 +48,7 @@ var COMPONENTNAME = 'atto_media',
'<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 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">' +
'<br/>' +
'<button class="submit" type="submit">{{get_string "createmedia" component}}</button>' +
@@ -99,7 +101,7 @@ Y.namespace('M.atto_media').Button = Y.Base.create('button', Y.M.editor_atto.Edi
var dialogue = this.getDialogue({
headerContent: M.util.get_string('createmedia', COMPONENTNAME),
focusAfterHide: true,
focusSelector: SELECTORS.URLINPUT
focusOnShowSelector: SELECTORS.URLINPUT
});
// Set the dialogue content, and then show the dialogue.
@@ -143,9 +145,9 @@ Y.namespace('M.atto_media').Button = Y.Base.create('button', Y.M.editor_atto.Edi
*/
_filepickerCallback: function(params) {
if (params.url !== '') {
this._content.one('.urlentry')
this._content.one(SELECTORS.URLINPUT)
.set('value', params.url);
this._content.one('.nameentry')
this._content.one(SELECTORS.NAMEINPUT)
.set('value', params.file);
}
},
@@ -164,8 +166,8 @@ Y.namespace('M.atto_media').Button = Y.Base.create('button', Y.M.editor_atto.Edi
}).hide();
var form = e.currentTarget.ancestor('.atto_form'),
url = form.one('.urlentry').get('value'),
name = form.one('.nameentry').get('value'),
url = form.one(SELECTORS.URLINPUT).get('value'),
name = form.one(SELECTORS.NAMEINPUT).get('value'),
host = this.get('host');
if (url !== '' && name !== '') {
@@ -1 +1 @@
YUI.add("moodle-atto_media-button",function(e,t){var n="atto_media",r={URLINPUT:"urlentry"},i={URLINPUT:"."+r.URLINPUT},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 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,focusSelector: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(".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"]});
@@ -35,10 +35,12 @@ YUI.add('moodle-atto_media-button', function (Y, NAME) {
var COMPONENTNAME = 'atto_media',
CSS = {
URLINPUT: 'urlentry'
URLINPUT: 'atto_media_urlentry',
NAMEINPUT: 'atto_media_nameentry'
},
SELECTORS = {
URLINPUT: '.' + CSS.URLINPUT
URLINPUT: '.' + CSS.URLINPUT,
NAMEINPUT: '.' + CSS.NAMEINPUT
},
TEMPLATE = '' +
'<form class="atto_form">' +
@@ -46,7 +48,7 @@ var COMPONENTNAME = 'atto_media',
'<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 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">' +
'<br/>' +
'<button class="submit" type="submit">{{get_string "createmedia" component}}</button>' +
@@ -99,7 +101,7 @@ Y.namespace('M.atto_media').Button = Y.Base.create('button', Y.M.editor_atto.Edi
var dialogue = this.getDialogue({
headerContent: M.util.get_string('createmedia', COMPONENTNAME),
focusAfterHide: true,
focusSelector: SELECTORS.URLINPUT
focusOnShowSelector: SELECTORS.URLINPUT
});
// Set the dialogue content, and then show the dialogue.
@@ -143,9 +145,9 @@ Y.namespace('M.atto_media').Button = Y.Base.create('button', Y.M.editor_atto.Edi
*/
_filepickerCallback: function(params) {
if (params.url !== '') {
this._content.one('.urlentry')
this._content.one(SELECTORS.URLINPUT)
.set('value', params.url);
this._content.one('.nameentry')
this._content.one(SELECTORS.NAMEINPUT)
.set('value', params.file);
}
},
@@ -164,8 +166,8 @@ Y.namespace('M.atto_media').Button = Y.Base.create('button', Y.M.editor_atto.Edi
}).hide();
var form = e.currentTarget.ancestor('.atto_form'),
url = form.one('.urlentry').get('value'),
name = form.one('.nameentry').get('value'),
url = form.one(SELECTORS.URLINPUT).get('value'),
name = form.one(SELECTORS.NAMEINPUT).get('value'),
host = this.get('host');
if (url !== '' && name !== '') {
+10 -8
View File
@@ -33,10 +33,12 @@
var COMPONENTNAME = 'atto_media',
CSS = {
URLINPUT: 'urlentry'
URLINPUT: 'atto_media_urlentry',
NAMEINPUT: 'atto_media_nameentry'
},
SELECTORS = {
URLINPUT: '.' + CSS.URLINPUT
URLINPUT: '.' + CSS.URLINPUT,
NAMEINPUT: '.' + CSS.NAMEINPUT
},
TEMPLATE = '' +
'<form class="atto_form">' +
@@ -44,7 +46,7 @@ var COMPONENTNAME = 'atto_media',
'<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 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">' +
'<br/>' +
'<button class="submit" type="submit">{{get_string "createmedia" component}}</button>' +
@@ -97,7 +99,7 @@ Y.namespace('M.atto_media').Button = Y.Base.create('button', Y.M.editor_atto.Edi
var dialogue = this.getDialogue({
headerContent: M.util.get_string('createmedia', COMPONENTNAME),
focusAfterHide: true,
focusSelector: SELECTORS.URLINPUT
focusOnShowSelector: SELECTORS.URLINPUT
});
// Set the dialogue content, and then show the dialogue.
@@ -141,9 +143,9 @@ Y.namespace('M.atto_media').Button = Y.Base.create('button', Y.M.editor_atto.Edi
*/
_filepickerCallback: function(params) {
if (params.url !== '') {
this._content.one('.urlentry')
this._content.one(SELECTORS.URLINPUT)
.set('value', params.url);
this._content.one('.nameentry')
this._content.one(SELECTORS.NAMEINPUT)
.set('value', params.file);
}
},
@@ -162,8 +164,8 @@ Y.namespace('M.atto_media').Button = Y.Base.create('button', Y.M.editor_atto.Edi
}).hide();
var form = e.currentTarget.ancestor('.atto_form'),
url = form.one('.urlentry').get('value'),
name = form.one('.nameentry').get('value'),
url = form.one(SELECTORS.URLINPUT).get('value'),
name = form.one(SELECTORS.NAMEINPUT).get('value'),
host = this.get('host');
if (url !== '' && name !== '') {
@@ -160,7 +160,7 @@ Y.namespace('M.atto_table').Button = Y.Base.create('button', Y.M.editor_atto.Edi
var dialogue = this.getDialogue({
headerContent: M.util.get_string('createtable', COMPONENT),
focusAfterHide: true,
focusSelector: SELECTORS.CAPTION
focusOnShowSelector: SELECTORS.CAPTION
});
// Set the dialogue content, and then show the dialogue.
@@ -881,7 +881,7 @@ Y.namespace('M.atto_table').Button = Y.Base.create('button', Y.M.editor_atto.Edi
var dialogue = this.getDialogue({
headerContent: M.util.get_string('edittable', COMPONENT),
focusAfterHide: false,
focusSelector: SELECTORS.CAPTION
focusOnShowSelector: SELECTORS.CAPTION
});
// Set the dialogue content, and then show the dialogue.
File diff suppressed because one or more lines are too long
@@ -160,7 +160,7 @@ Y.namespace('M.atto_table').Button = Y.Base.create('button', Y.M.editor_atto.Edi
var dialogue = this.getDialogue({
headerContent: M.util.get_string('createtable', COMPONENT),
focusAfterHide: true,
focusSelector: SELECTORS.CAPTION
focusOnShowSelector: SELECTORS.CAPTION
});
// Set the dialogue content, and then show the dialogue.
@@ -881,7 +881,7 @@ Y.namespace('M.atto_table').Button = Y.Base.create('button', Y.M.editor_atto.Edi
var dialogue = this.getDialogue({
headerContent: M.util.get_string('edittable', COMPONENT),
focusAfterHide: false,
focusSelector: SELECTORS.CAPTION
focusOnShowSelector: SELECTORS.CAPTION
});
// Set the dialogue content, and then show the dialogue.
+2 -2
View File
@@ -158,7 +158,7 @@ Y.namespace('M.atto_table').Button = Y.Base.create('button', Y.M.editor_atto.Edi
var dialogue = this.getDialogue({
headerContent: M.util.get_string('createtable', COMPONENT),
focusAfterHide: true,
focusSelector: SELECTORS.CAPTION
focusOnShowSelector: SELECTORS.CAPTION
});
// Set the dialogue content, and then show the dialogue.
@@ -879,7 +879,7 @@ Y.namespace('M.atto_table').Button = Y.Base.create('button', Y.M.editor_atto.Edi
var dialogue = this.getDialogue({
headerContent: M.util.get_string('edittable', COMPONENT),
focusAfterHide: false,
focusSelector: SELECTORS.CAPTION
focusOnShowSelector: SELECTORS.CAPTION
});
// Set the dialogue content, and then show the dialogue.
@@ -313,7 +313,7 @@ Y.extend(DIALOGUE, Y.Panel, {
var result = null,
header = this.headerNode,
content = this.bodyNode,
focusSelector = this.get('focusSelector'),
focusSelector = this.get('focusOnShowSelector'),
focusNode = null;
result = DIALOGUE.superclass.show.call(this);
@@ -325,8 +325,8 @@ Y.extend(DIALOGUE, Y.Panel, {
this.lockScroll.enableScrollLock(this.shouldResizeFullscreen());
}
// Try and find a node to focus on using the focusSelector attribute.
if (focusSelector !== '') {
// Try and find a node to focus on using the focusOnShowSelector attribute.
if (focusSelector !== null) {
focusNode = this.get('boundingBox').one(focusSelector);
}
if (!focusNode) {
@@ -337,7 +337,9 @@ Y.extend(DIALOGUE, Y.Panel, {
focusNode = content;
}
}
focusNode.focus();
if (focusNode) {
focusNode.focus();
}
return result;
},
@@ -504,7 +506,21 @@ Y.extend(DIALOGUE, Y.Panel, {
*/
responsiveWidth : {
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
}
}
});
@@ -544,19 +560,6 @@ Y.Base.modifyAttrs(DIALOGUE, {
value: false
},
/**
* Selector to a node that should recieve focus when this dialogue is shown.
*
* The default behaviour is to focus on the header.
*
* @attribute focusSelector
* @default ''
* @type String
*/
focusSelector: {
value: ''
},
/**
* A convenience Attribute, which can be used as a shortcut for the
* `align` Attribute.
File diff suppressed because one or more lines are too long
@@ -313,7 +313,7 @@ Y.extend(DIALOGUE, Y.Panel, {
var result = null,
header = this.headerNode,
content = this.bodyNode,
focusSelector = this.get('focusSelector'),
focusSelector = this.get('focusOnShowSelector'),
focusNode = null;
result = DIALOGUE.superclass.show.call(this);
@@ -325,8 +325,8 @@ Y.extend(DIALOGUE, Y.Panel, {
this.lockScroll.enableScrollLock(this.shouldResizeFullscreen());
}
// Try and find a node to focus on using the focusSelector attribute.
if (focusSelector !== '') {
// Try and find a node to focus on using the focusOnShowSelector attribute.
if (focusSelector !== null) {
focusNode = this.get('boundingBox').one(focusSelector);
}
if (!focusNode) {
@@ -337,7 +337,9 @@ Y.extend(DIALOGUE, Y.Panel, {
focusNode = content;
}
}
focusNode.focus();
if (focusNode) {
focusNode.focus();
}
return result;
},
@@ -502,7 +504,21 @@ Y.extend(DIALOGUE, Y.Panel, {
*/
responsiveWidth : {
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
}
}
});
@@ -542,19 +558,6 @@ Y.Base.modifyAttrs(DIALOGUE, {
value: false
},
/**
* Selector to a node that should recieve focus when this dialogue is shown.
*
* The default behaviour is to focus on the header.
*
* @attribute focusSelector
* @default ''
* @type String
*/
focusSelector: {
value: ''
},
/**
* A convenience Attribute, which can be used as a shortcut for the
* `align` Attribute.
+20 -17
View File
@@ -284,7 +284,7 @@ Y.extend(DIALOGUE, Y.Panel, {
var result = null,
header = this.headerNode,
content = this.bodyNode,
focusSelector = this.get('focusSelector'),
focusSelector = this.get('focusOnShowSelector'),
focusNode = null;
result = DIALOGUE.superclass.show.call(this);
@@ -296,8 +296,8 @@ Y.extend(DIALOGUE, Y.Panel, {
this.lockScroll.enableScrollLock(this.shouldResizeFullscreen());
}
// Try and find a node to focus on using the focusSelector attribute.
if (focusSelector !== '') {
// Try and find a node to focus on using the focusOnShowSelector attribute.
if (focusSelector !== null) {
focusNode = this.get('boundingBox').one(focusSelector);
}
if (!focusNode) {
@@ -308,7 +308,9 @@ Y.extend(DIALOGUE, Y.Panel, {
focusNode = content;
}
}
focusNode.focus();
if (focusNode) {
focusNode.focus();
}
return result;
},
@@ -475,7 +477,21 @@ Y.extend(DIALOGUE, Y.Panel, {
*/
responsiveWidth : {
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
}
}
});
@@ -515,19 +531,6 @@ Y.Base.modifyAttrs(DIALOGUE, {
value: false
},
/**
* Selector to a node that should recieve focus when this dialogue is shown.
*
* The default behaviour is to focus on the header.
*
* @attribute focusSelector
* @default ''
* @type String
*/
focusSelector: {
value: ''
},
/**
* A convenience Attribute, which can be used as a shortcut for the
* `align` Attribute.