And some minor cleanups.
headerContent: M.util.get_string('pluginname', COMPONENTNAME),
focusAfterHide: true,
width: 600,
- focusSelector: SELECTORS.EQUATION_TEXT
+ focusOnShowSelector: SELECTORS.EQUATION_TEXT
});
var content = this._getDialogueContent();
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.
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.
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">' +
'<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>' +
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.
*/
_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);
}
},
}).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 !== '') {
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.
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.
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);
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) {
focusNode = content;
}
}
- focusNode.focus();
+ if (focusNode) {
+ focusNode.focus();
+ }
return result;
},
*/
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
}
+
}
});
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.