From 9e801be4528200f37b1983320f1921366a30938d Mon Sep 17 00:00:00 2001 From: Shamim Rezaie Date: Wed, 2 Jun 2021 20:11:58 +1000 Subject: [PATCH] MDL-71672 atto_recordrtc: focus Atto button after hide --- .../moodle-atto_recordrtc-button-debug.js | 16 ++++++++++++---- .../moodle-atto_recordrtc-button-min.js | 2 +- .../moodle-atto_recordrtc-button.js | 16 ++++++++++++---- .../recordrtc/yui/src/button/js/button.js | 16 ++++++++++++---- 4 files changed, 37 insertions(+), 13 deletions(-) diff --git a/lib/editor/atto/plugins/recordrtc/yui/build/moodle-atto_recordrtc-button/moodle-atto_recordrtc-button-debug.js b/lib/editor/atto/plugins/recordrtc/yui/build/moodle-atto_recordrtc-button/moodle-atto_recordrtc-button-debug.js index e6fd0f403b2..b13c08e142d 100644 --- a/lib/editor/atto/plugins/recordrtc/yui/build/moodle-atto_recordrtc-button/moodle-atto_recordrtc-button-debug.js +++ b/lib/editor/atto/plugins/recordrtc/yui/build/moodle-atto_recordrtc-button/moodle-atto_recordrtc-button-debug.js @@ -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); diff --git a/lib/editor/atto/plugins/recordrtc/yui/build/moodle-atto_recordrtc-button/moodle-atto_recordrtc-button-min.js b/lib/editor/atto/plugins/recordrtc/yui/build/moodle-atto_recordrtc-button/moodle-atto_recordrtc-button-min.js index 013087c2f2b..b4f3de302f6 100644 --- a/lib/editor/atto/plugins/recordrtc/yui/build/moodle-atto_recordrtc-button/moodle-atto_recordrtc-button-min.js +++ b/lib/editor/atto/plugins/recordrtc/yui/build/moodle-atto_recordrtc-button/moodle-atto_recordrtc-button-min.js @@ -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('
{{insecurealert_title}} {{insecurealert}}
{{#if isAudio}}
{{else}}
{{/if}}
')({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"]}); \ No newline at end of file +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('
{{insecurealert_title}} {{insecurealert}}
{{#if isAudio}}
{{else}}
{{/if}}
')({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"]}); \ No newline at end of file diff --git a/lib/editor/atto/plugins/recordrtc/yui/build/moodle-atto_recordrtc-button/moodle-atto_recordrtc-button.js b/lib/editor/atto/plugins/recordrtc/yui/build/moodle-atto_recordrtc-button/moodle-atto_recordrtc-button.js index e6fd0f403b2..b13c08e142d 100644 --- a/lib/editor/atto/plugins/recordrtc/yui/build/moodle-atto_recordrtc-button/moodle-atto_recordrtc-button.js +++ b/lib/editor/atto/plugins/recordrtc/yui/build/moodle-atto_recordrtc-button/moodle-atto_recordrtc-button.js @@ -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); diff --git a/lib/editor/atto/plugins/recordrtc/yui/src/button/js/button.js b/lib/editor/atto/plugins/recordrtc/yui/src/button/js/button.js index bba8d70e050..ab7081df907 100644 --- a/lib/editor/atto/plugins/recordrtc/yui/src/button/js/button.js +++ b/lib/editor/atto/plugins/recordrtc/yui/src/button/js/button.js @@ -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);