mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
MDL-71672 atto_recordrtc: focus Atto button after hide
This commit is contained in:
parent
2092f152b2
commit
9e801be452
@ -184,7 +184,9 @@ Y.namespace('M.atto_recordrtc').Button = Y.Base.create('button', Y.M.editor_atto
|
||||
* @private
|
||||
*/
|
||||
_audio: function() {
|
||||
var dialogue = this.getDialogue();
|
||||
var dialogue = this.getDialogue({
|
||||
focusAfterHide: 'audio'
|
||||
});
|
||||
|
||||
dialogue.set('headerContent', M.util.get_string('audiortc', 'atto_recordrtc'));
|
||||
dialogue.set('bodyContent', this._createContent('audio'));
|
||||
@ -201,7 +203,9 @@ Y.namespace('M.atto_recordrtc').Button = Y.Base.create('button', Y.M.editor_atto
|
||||
* @private
|
||||
*/
|
||||
_video: function() {
|
||||
var dialogue = this.getDialogue();
|
||||
var dialogue = this.getDialogue({
|
||||
focusAfterHide: 'video'
|
||||
});
|
||||
|
||||
dialogue.set('headerContent', M.util.get_string('videortc', 'atto_recordrtc'));
|
||||
dialogue.set('bodyContent', this._createContent('video'));
|
||||
@ -249,7 +253,9 @@ Y.namespace('M.atto_recordrtc').Button = Y.Base.create('button', Y.M.editor_atto
|
||||
* @param {Object} scope The "this" context of the editor.
|
||||
*/
|
||||
closeDialogue: function(scope) {
|
||||
scope.getDialogue().hide();
|
||||
scope.getDialogue().hide({
|
||||
focusAfterHide: null
|
||||
});
|
||||
|
||||
scope.editor.focus();
|
||||
},
|
||||
@ -262,7 +268,9 @@ Y.namespace('M.atto_recordrtc').Button = Y.Base.create('button', Y.M.editor_atto
|
||||
* @param {string} annotation The HTML link to the recording.
|
||||
*/
|
||||
setLink: function(scope, annotation) {
|
||||
scope.getDialogue().hide();
|
||||
scope.getDialogue().hide({
|
||||
focusAfterHide: null
|
||||
});
|
||||
|
||||
scope.editor.focus();
|
||||
scope.get('host').insertContentAtFocusPoint(annotation);
|
||||
|
@ -1 +1 @@
|
||||
YUI.add("moodle-atto_recordrtc-button",function(s,t){var n="atto_recordrtc";s.namespace("M.atto_recordrtc").Button=s.Base.create("button",s.M.editor_atto.EditorPlugin,[],{_lang:"en",initializer:function(){var t,e,i;if(this.get("host").canShowFilepicker("media")){if(e=!1,"both"!==(t=this.get("allowedtypes"))&&"audio"!==t||(this._addButton("audio",this._audio),e=!0),"both"!==t&&"video"!==t||(this._addButton("video",this._video),e=!0),!e)return;(i=this.getDialogue({width:1e3,focusAfterHide:null})).after("visibleChange",function(){var t=!i.get("visible"),e=M.atto_recordrtc.commonmodule;t&&(window.clearInterval(e.countdownTicker),e.mediaRecorder&&"inactive"!==e.mediaRecorder.state&&e.mediaRecorder.stop(),e.stream&&e.stream.getTracks().forEach(function(t){"ended"!==t.readyState&&t.stop()}),this.getDialogue().set("bodyContent",""))},this),i.on("click",function(){this.centered()}),window.require(["core/adapter"],function(t){window.adapter=t})}},_addButton:function(t,e){this.addButton({buttonName:t,icon:this.get(t+"rtcicon"),iconComponent:n,callback:e,title:t+"rtc",tags:t+"rtc",tagMatchRequiresAll:!1})},_audio:function(){var t=this.getDialogue();t.set("headerContent",M.util.get_string("audiortc","atto_recordrtc")),t.set("bodyContent",this._createContent("audio")),t.show(),M.atto_recordrtc.audiomodule.init(this)},_video:function(){var t=this.getDialogue();t.set("headerContent",M.util.get_string("videortc","atto_recordrtc")),t.set("bodyContent",this._createContent("video")),t.show(),M.atto_recordrtc.videomodule.init(this)},_createContent:function(t){var e="audio"===t,i="row",o="col-",r="alert-danger",a="btn btn-lg btn-outline-danger btn-block",d=s.Handlebars.compile('<div class="{{PLUGINNAME}} container-fluid"><div class="{{bs_row}} hide"><div class="{{bs_col}}12"><div id="alert-danger" class="alert {{bs_al_dang}}"><strong>{{insecurealert_title}}</strong> {{insecurealert}}</div></div></div><div class="{{bs_row}} hide">{{#if isAudio}}<div class="{{bs_col}}1"></div><div class="{{bs_col}}10"><audio id="player"></audio></div><div class="{{bs_col}}1"></div>{{else}}<div class="{{bs_col}}12"><video id="player"></video></div>{{/if}}</div><div class="{{bs_row}}"><div class="{{bs_col}}1"></div><div class="{{bs_col}}10"><button id="start-stop" class="{{bs_ss_btn}}">{{startrecording}}</button></div><div class="{{bs_col}}1"></div></div><div class="{{bs_row}} hide"><div class="{{bs_col}}3"></div><div class="{{bs_col}}6"><button id="upload" class="btn btn-primary btn-block">{{attachrecording}}</button></div><div class="{{bs_col}}3"></div></div></div>')({PLUGINNAME:n,isAudio:e,bs_row:i,bs_col:o,bs_al_dang:r,bs_ss_btn:a,insecurealert_title:M.util.get_string("insecurealert_title","atto_recordrtc"),insecurealert:M.util.get_string("insecurealert","atto_recordrtc"),startrecording:M.util.get_string("startrecording","atto_recordrtc"),attachrecording:M.util.get_string("attachrecording","atto_recordrtc")});return d},closeDialogue:function(t){t.getDialogue().hide(),t.editor.focus()},setLink:function(t,e){t.getDialogue().hide(),t.editor.focus(),t.get("host").insertContentAtFocusPoint(e),t.markUpdated()}},{ATTRS:{contextid:{value:null},sesskey:{value:null},allowedtypes:{value:null},audiobitrate:{value:null},videobitrate:{value:null},timelimit:{value:null},audiortcicon:{value:null},videortcicon:{value:null},maxrecsize:{value:null}}})},"@VERSION@",{requires:["moodle-editor_atto-plugin","moodle-atto_recordrtc-recording"]});
|
||||
YUI.add("moodle-atto_recordrtc-button",function(s,t){var n="atto_recordrtc";s.namespace("M.atto_recordrtc").Button=s.Base.create("button",s.M.editor_atto.EditorPlugin,[],{_lang:"en",initializer:function(){var t,e,i;if(this.get("host").canShowFilepicker("media")){if(e=!1,"both"!==(t=this.get("allowedtypes"))&&"audio"!==t||(this._addButton("audio",this._audio),e=!0),"both"!==t&&"video"!==t||(this._addButton("video",this._video),e=!0),!e)return;(i=this.getDialogue({width:1e3,focusAfterHide:null})).after("visibleChange",function(){var t=!i.get("visible"),e=M.atto_recordrtc.commonmodule;t&&(window.clearInterval(e.countdownTicker),e.mediaRecorder&&"inactive"!==e.mediaRecorder.state&&e.mediaRecorder.stop(),e.stream&&e.stream.getTracks().forEach(function(t){"ended"!==t.readyState&&t.stop()}),this.getDialogue().set("bodyContent",""))},this),i.on("click",function(){this.centered()}),window.require(["core/adapter"],function(t){window.adapter=t})}},_addButton:function(t,e){this.addButton({buttonName:t,icon:this.get(t+"rtcicon"),iconComponent:n,callback:e,title:t+"rtc",tags:t+"rtc",tagMatchRequiresAll:!1})},_audio:function(){var t=this.getDialogue({focusAfterHide:"audio"});t.set("headerContent",M.util.get_string("audiortc","atto_recordrtc")),t.set("bodyContent",this._createContent("audio")),t.show(),M.atto_recordrtc.audiomodule.init(this)},_video:function(){var t=this.getDialogue({focusAfterHide:"video"});t.set("headerContent",M.util.get_string("videortc","atto_recordrtc")),t.set("bodyContent",this._createContent("video")),t.show(),M.atto_recordrtc.videomodule.init(this)},_createContent:function(t){var e="audio"===t,i="row",o="col-",r="alert-danger",d="btn btn-lg btn-outline-danger btn-block",a=s.Handlebars.compile('<div class="{{PLUGINNAME}} container-fluid"><div class="{{bs_row}} hide"><div class="{{bs_col}}12"><div id="alert-danger" class="alert {{bs_al_dang}}"><strong>{{insecurealert_title}}</strong> {{insecurealert}}</div></div></div><div class="{{bs_row}} hide">{{#if isAudio}}<div class="{{bs_col}}1"></div><div class="{{bs_col}}10"><audio id="player"></audio></div><div class="{{bs_col}}1"></div>{{else}}<div class="{{bs_col}}12"><video id="player"></video></div>{{/if}}</div><div class="{{bs_row}}"><div class="{{bs_col}}1"></div><div class="{{bs_col}}10"><button id="start-stop" class="{{bs_ss_btn}}">{{startrecording}}</button></div><div class="{{bs_col}}1"></div></div><div class="{{bs_row}} hide"><div class="{{bs_col}}3"></div><div class="{{bs_col}}6"><button id="upload" class="btn btn-primary btn-block">{{attachrecording}}</button></div><div class="{{bs_col}}3"></div></div></div>')({PLUGINNAME:n,isAudio:e,bs_row:i,bs_col:o,bs_al_dang:r,bs_ss_btn:d,insecurealert_title:M.util.get_string("insecurealert_title","atto_recordrtc"),insecurealert:M.util.get_string("insecurealert","atto_recordrtc"),startrecording:M.util.get_string("startrecording","atto_recordrtc"),attachrecording:M.util.get_string("attachrecording","atto_recordrtc")});return a},closeDialogue:function(t){t.getDialogue().hide({focusAfterHide:null}),t.editor.focus()},setLink:function(t,e){t.getDialogue().hide({focusAfterHide:null}),t.editor.focus(),t.get("host").insertContentAtFocusPoint(e),t.markUpdated()}},{ATTRS:{contextid:{value:null},sesskey:{value:null},allowedtypes:{value:null},audiobitrate:{value:null},videobitrate:{value:null},timelimit:{value:null},audiortcicon:{value:null},videortcicon:{value:null},maxrecsize:{value:null}}})},"@VERSION@",{requires:["moodle-editor_atto-plugin","moodle-atto_recordrtc-recording"]});
|
@ -184,7 +184,9 @@ Y.namespace('M.atto_recordrtc').Button = Y.Base.create('button', Y.M.editor_atto
|
||||
* @private
|
||||
*/
|
||||
_audio: function() {
|
||||
var dialogue = this.getDialogue();
|
||||
var dialogue = this.getDialogue({
|
||||
focusAfterHide: 'audio'
|
||||
});
|
||||
|
||||
dialogue.set('headerContent', M.util.get_string('audiortc', 'atto_recordrtc'));
|
||||
dialogue.set('bodyContent', this._createContent('audio'));
|
||||
@ -201,7 +203,9 @@ Y.namespace('M.atto_recordrtc').Button = Y.Base.create('button', Y.M.editor_atto
|
||||
* @private
|
||||
*/
|
||||
_video: function() {
|
||||
var dialogue = this.getDialogue();
|
||||
var dialogue = this.getDialogue({
|
||||
focusAfterHide: 'video'
|
||||
});
|
||||
|
||||
dialogue.set('headerContent', M.util.get_string('videortc', 'atto_recordrtc'));
|
||||
dialogue.set('bodyContent', this._createContent('video'));
|
||||
@ -249,7 +253,9 @@ Y.namespace('M.atto_recordrtc').Button = Y.Base.create('button', Y.M.editor_atto
|
||||
* @param {Object} scope The "this" context of the editor.
|
||||
*/
|
||||
closeDialogue: function(scope) {
|
||||
scope.getDialogue().hide();
|
||||
scope.getDialogue().hide({
|
||||
focusAfterHide: null
|
||||
});
|
||||
|
||||
scope.editor.focus();
|
||||
},
|
||||
@ -262,7 +268,9 @@ Y.namespace('M.atto_recordrtc').Button = Y.Base.create('button', Y.M.editor_atto
|
||||
* @param {string} annotation The HTML link to the recording.
|
||||
*/
|
||||
setLink: function(scope, annotation) {
|
||||
scope.getDialogue().hide();
|
||||
scope.getDialogue().hide({
|
||||
focusAfterHide: null
|
||||
});
|
||||
|
||||
scope.editor.focus();
|
||||
scope.get('host').insertContentAtFocusPoint(annotation);
|
||||
|
@ -182,7 +182,9 @@ Y.namespace('M.atto_recordrtc').Button = Y.Base.create('button', Y.M.editor_atto
|
||||
* @private
|
||||
*/
|
||||
_audio: function() {
|
||||
var dialogue = this.getDialogue();
|
||||
var dialogue = this.getDialogue({
|
||||
focusAfterHide: 'audio'
|
||||
});
|
||||
|
||||
dialogue.set('headerContent', M.util.get_string('audiortc', 'atto_recordrtc'));
|
||||
dialogue.set('bodyContent', this._createContent('audio'));
|
||||
@ -199,7 +201,9 @@ Y.namespace('M.atto_recordrtc').Button = Y.Base.create('button', Y.M.editor_atto
|
||||
* @private
|
||||
*/
|
||||
_video: function() {
|
||||
var dialogue = this.getDialogue();
|
||||
var dialogue = this.getDialogue({
|
||||
focusAfterHide: 'video'
|
||||
});
|
||||
|
||||
dialogue.set('headerContent', M.util.get_string('videortc', 'atto_recordrtc'));
|
||||
dialogue.set('bodyContent', this._createContent('video'));
|
||||
@ -247,7 +251,9 @@ Y.namespace('M.atto_recordrtc').Button = Y.Base.create('button', Y.M.editor_atto
|
||||
* @param {Object} scope The "this" context of the editor.
|
||||
*/
|
||||
closeDialogue: function(scope) {
|
||||
scope.getDialogue().hide();
|
||||
scope.getDialogue().hide({
|
||||
focusAfterHide: null
|
||||
});
|
||||
|
||||
scope.editor.focus();
|
||||
},
|
||||
@ -260,7 +266,9 @@ Y.namespace('M.atto_recordrtc').Button = Y.Base.create('button', Y.M.editor_atto
|
||||
* @param {string} annotation The HTML link to the recording.
|
||||
*/
|
||||
setLink: function(scope, annotation) {
|
||||
scope.getDialogue().hide();
|
||||
scope.getDialogue().hide({
|
||||
focusAfterHide: null
|
||||
});
|
||||
|
||||
scope.editor.focus();
|
||||
scope.get('host').insertContentAtFocusPoint(annotation);
|
||||
|
Loading…
x
Reference in New Issue
Block a user