diff --git a/lib/editor/tiny/plugins/media/amd/build/manager.min.js b/lib/editor/tiny/plugins/media/amd/build/manager.min.js index 948665771aea3..9e8c4cfd6ec66 100644 --- a/lib/editor/tiny/plugins/media/amd/build/manager.min.js +++ b/lib/editor/tiny/plugins/media/amd/build/manager.min.js @@ -1,3 +1,3 @@ -define("tiny_media/manager",["exports","core/templates","core/str","core/modal_factory","core/modal_events","./options","core/config"],(function(_exports,_templates,_str,Modal,ModalEvents,_options,_config){function _getRequireWildcardCache(nodeInterop){if("function"!=typeof WeakMap)return null;var cacheBabelInterop=new WeakMap,cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule)return obj;if(null===obj||"object"!=typeof obj&&"function"!=typeof obj)return{default:obj};var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj))return cache.get(obj);var newObj={},hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj)if("default"!==key&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;desc&&(desc.get||desc.set)?Object.defineProperty(newObj,key,desc):newObj[key]=obj[key]}return newObj.default=obj,cache&&cache.set(obj,newObj),newObj}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.MediaManager=void 0,_templates=_interopRequireDefault(_templates),Modal=_interopRequireWildcard(Modal),ModalEvents=_interopRequireWildcard(ModalEvents),_config=_interopRequireDefault(_config);_exports.MediaManager=class{constructor(editor){_defineProperty(this,"editor",null),_defineProperty(this,"area",null),_defineProperty(this,"displayDialogue",(()=>{Modal.create({type:Modal.types.DEFAULT,large:!0,title:(0,_str.get_string)("mediamanagerproperties","tiny_media"),body:_templates.default.render("tiny_media/mm_iframe",{src:this.getIframeURL()})}).then((modal=>(modal.getRoot().on(ModalEvents.bodyRendered,(()=>{this.selectFirstElement()})),modal.getRoot().on(ModalEvents.hidden,(()=>{modal.destroy()})),modal.show(),document.querySelector(".modal-lg").style.cssText="max-width: 850px",modal))).catch()})),_defineProperty(this,"selectFirstElement",(()=>{const iframe=document.getElementById("mm-iframe");iframe.addEventListener("load",(function(){let intervalId=setInterval((function(){const iDocument=iframe.contentWindow.document;if(iDocument.querySelector(".filemanager")){const firstFocusableElement=iDocument.querySelector(".fp-navbar a:not([disabled])");firstFocusableElement&&firstFocusableElement.focus(),clearInterval(intervalId)}}),200)}))})),_defineProperty(this,"getIframeURL",(()=>{const url=new URL("".concat(_config.default.wwwroot,"/lib/editor/tiny/plugins/media/manage.php"));url.searchParams.append("elementid",this.editor.getElement().id);for(const key in this.area)url.searchParams.append(key,this.area[key]);return url.toString()})),this.editor=editor;const data=(0,_options.getData)(editor);window.console.log(data),this.area=data.params.area,this.area.itemid=data.fpoptions.image.itemid}}})); +define("tiny_media/manager",["exports","core/templates","core/str","core/modal_factory","core/modal_events","./options","core/config"],(function(_exports,_templates,_str,Modal,ModalEvents,_options,_config){function _getRequireWildcardCache(nodeInterop){if("function"!=typeof WeakMap)return null;var cacheBabelInterop=new WeakMap,cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule)return obj;if(null===obj||"object"!=typeof obj&&"function"!=typeof obj)return{default:obj};var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj))return cache.get(obj);var newObj={},hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj)if("default"!==key&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;desc&&(desc.get||desc.set)?Object.defineProperty(newObj,key,desc):newObj[key]=obj[key]}return newObj.default=obj,cache&&cache.set(obj,newObj),newObj}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.MediaManager=void 0,_templates=_interopRequireDefault(_templates),Modal=_interopRequireWildcard(Modal),ModalEvents=_interopRequireWildcard(ModalEvents),_config=_interopRequireDefault(_config);_exports.MediaManager=class{constructor(editor){_defineProperty(this,"editor",null),_defineProperty(this,"area",null),_defineProperty(this,"displayDialogue",(()=>{Modal.create({type:Modal.types.DEFAULT,large:!0,title:(0,_str.get_string)("mediamanagerproperties","tiny_media"),body:_templates.default.render("tiny_media/mm_iframe",{src:this.getIframeURL()})}).then((modal=>(modal.getRoot().on(ModalEvents.bodyRendered,(()=>{this.selectFirstElement()})),modal.getRoot().on(ModalEvents.hidden,(()=>{modal.destroy()})),modal.show(),document.querySelector(".modal-lg").style.cssText="max-width: 850px",modal))).catch()})),_defineProperty(this,"selectFirstElement",(()=>{const iframe=document.getElementById("mm-iframe");iframe.addEventListener("load",(function(){let intervalId=setInterval((function(){const iDocument=iframe.contentWindow.document;if(iDocument.querySelector(".filemanager")){const firstFocusableElement=iDocument.querySelector(".fp-navbar a:not([disabled])");firstFocusableElement&&firstFocusableElement.focus(),clearInterval(intervalId)}}),200)}))})),_defineProperty(this,"getIframeURL",(()=>{const url=new URL("".concat(_config.default.wwwroot,"/lib/editor/tiny/plugins/media/manage.php"));url.searchParams.append("elementid",this.editor.getElement().id);for(const key in this.area)url.searchParams.append(key,this.area[key]);return url.toString()})),this.editor=editor;const data=(0,_options.getData)(editor);this.area=data.params.area,this.area.itemid=data.fpoptions.image.itemid}}})); //# sourceMappingURL=manager.min.js.map \ No newline at end of file diff --git a/lib/editor/tiny/plugins/media/amd/build/manager.min.js.map b/lib/editor/tiny/plugins/media/amd/build/manager.min.js.map index 6cd86f223c9d8..b1e4a51c09c2d 100644 --- a/lib/editor/tiny/plugins/media/amd/build/manager.min.js.map +++ b/lib/editor/tiny/plugins/media/amd/build/manager.min.js.map @@ -1 +1 @@ -{"version":3,"file":"manager.min.js","sources":["../src/manager.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n/**\n * Tiny Media Manager plugin class for Moodle.\n *\n * @module tiny_media/manager\n * @copyright 2022, Stevani Andolo \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport Templates from 'core/templates';\nimport {get_string as getString} from 'core/str';\nimport * as Modal from 'core/modal_factory';\nimport * as ModalEvents from 'core/modal_events';\nimport {getData} from './options';\nimport Config from 'core/config';\n\nexport const MediaManager = class {\n\n editor = null;\n area = null;\n\n constructor(editor) {\n this.editor = editor;\n const data = getData(editor);\n window.console.log(data);\n this.area = data.params.area;\n this.area.itemid = data.fpoptions.image.itemid;\n }\n\n displayDialogue = () => {\n Modal.create({\n type: Modal.types.DEFAULT,\n large: true,\n title: getString('mediamanagerproperties', 'tiny_media'),\n body: Templates.render('tiny_media/mm_iframe', {\n src: this.getIframeURL()\n })\n }).then(modal => {\n modal.getRoot().on(ModalEvents.bodyRendered, () => {\n this.selectFirstElement();\n });\n modal.getRoot().on(ModalEvents.hidden, () => {\n modal.destroy();\n });\n modal.show();\n document.querySelector('.modal-lg').style.cssText = `max-width: 850px`;\n return modal;\n }).catch();\n };\n\n // It will select the first element in the file manager.\n selectFirstElement = () => {\n const iframe = document.getElementById('mm-iframe');\n iframe.addEventListener('load', function() {\n let intervalId = setInterval(function() {\n const iDocument = iframe.contentWindow.document;\n if (iDocument.querySelector('.filemanager')) {\n const firstFocusableElement = iDocument.querySelector('.fp-navbar a:not([disabled])');\n if (firstFocusableElement) {\n firstFocusableElement.focus();\n }\n clearInterval(intervalId);\n }\n }, 200);\n });\n };\n\n getIframeURL = () => {\n const url = new URL(`${Config.wwwroot}/lib/editor/tiny/plugins/media/manage.php`);\n url.searchParams.append('elementid', this.editor.getElement().id);\n for (const key in this.area) {\n url.searchParams.append(key, this.area[key]);\n }\n return url.toString();\n };\n};\n"],"names":["constructor","editor","Modal","create","type","types","DEFAULT","large","title","body","Templates","render","src","this","getIframeURL","then","modal","getRoot","on","ModalEvents","bodyRendered","selectFirstElement","hidden","destroy","show","document","querySelector","style","cssText","catch","iframe","getElementById","addEventListener","intervalId","setInterval","iDocument","contentWindow","firstFocusableElement","focus","clearInterval","url","URL","Config","wwwroot","searchParams","append","getElement","id","key","area","toString","data","window","console","log","params","itemid","fpoptions","image"],"mappings":"kpDA8B4B,MAKxBA,YAAYC,sCAHH,kCACF,8CAUW,KACdC,MAAMC,OAAO,CACTC,KAAMF,MAAMG,MAAMC,QAClBC,OAAO,EACPC,OAAO,mBAAU,yBAA0B,cAC3CC,KAAMC,mBAAUC,OAAO,uBAAwB,CAC3CC,IAAKC,KAAKC,mBAEfC,MAAKC,QACJA,MAAMC,UAAUC,GAAGC,YAAYC,cAAc,UACpCC,wBAETL,MAAMC,UAAUC,GAAGC,YAAYG,QAAQ,KACnCN,MAAMO,aAEVP,MAAMQ,OACNC,SAASC,cAAc,aAAaC,MAAMC,2BACnCZ,SACRa,sDAIc,WACXC,OAASL,SAASM,eAAe,aACvCD,OAAOE,iBAAiB,QAAQ,eACxBC,WAAaC,aAAY,iBACnBC,UAAYL,OAAOM,cAAcX,YACnCU,UAAUT,cAAc,gBAAiB,OACnCW,sBAAwBF,UAAUT,cAAc,gCAClDW,uBACAA,sBAAsBC,QAE1BC,cAAcN,eAEnB,gDAII,WACLO,IAAM,IAAIC,cAAOC,gBAAOC,sDAC9BH,IAAII,aAAaC,OAAO,YAAahC,KAAKZ,OAAO6C,aAAaC,QACzD,MAAMC,OAAOnC,KAAKoC,KACnBT,IAAII,aAAaC,OAAOG,IAAKnC,KAAKoC,KAAKD,aAEpCR,IAAIU,mBAnDNjD,OAASA,aACRkD,MAAO,oBAAQlD,QACrBmD,OAAOC,QAAQC,IAAIH,WACdF,KAAOE,KAAKI,OAAON,UACnBA,KAAKO,OAASL,KAAKM,UAAUC,MAAMF"} \ No newline at end of file +{"version":3,"file":"manager.min.js","sources":["../src/manager.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n/**\n * Tiny Media Manager plugin class for Moodle.\n *\n * @module tiny_media/manager\n * @copyright 2022, Stevani Andolo \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport Templates from 'core/templates';\nimport {get_string as getString} from 'core/str';\nimport * as Modal from 'core/modal_factory';\nimport * as ModalEvents from 'core/modal_events';\nimport {getData} from './options';\nimport Config from 'core/config';\n\nexport const MediaManager = class {\n\n editor = null;\n area = null;\n\n constructor(editor) {\n this.editor = editor;\n const data = getData(editor);\n this.area = data.params.area;\n this.area.itemid = data.fpoptions.image.itemid;\n }\n\n displayDialogue = () => {\n Modal.create({\n type: Modal.types.DEFAULT,\n large: true,\n title: getString('mediamanagerproperties', 'tiny_media'),\n body: Templates.render('tiny_media/mm_iframe', {\n src: this.getIframeURL()\n })\n }).then(modal => {\n modal.getRoot().on(ModalEvents.bodyRendered, () => {\n this.selectFirstElement();\n });\n modal.getRoot().on(ModalEvents.hidden, () => {\n modal.destroy();\n });\n modal.show();\n document.querySelector('.modal-lg').style.cssText = `max-width: 850px`;\n return modal;\n }).catch();\n };\n\n // It will select the first element in the file manager.\n selectFirstElement = () => {\n const iframe = document.getElementById('mm-iframe');\n iframe.addEventListener('load', function() {\n let intervalId = setInterval(function() {\n const iDocument = iframe.contentWindow.document;\n if (iDocument.querySelector('.filemanager')) {\n const firstFocusableElement = iDocument.querySelector('.fp-navbar a:not([disabled])');\n if (firstFocusableElement) {\n firstFocusableElement.focus();\n }\n clearInterval(intervalId);\n }\n }, 200);\n });\n };\n\n getIframeURL = () => {\n const url = new URL(`${Config.wwwroot}/lib/editor/tiny/plugins/media/manage.php`);\n url.searchParams.append('elementid', this.editor.getElement().id);\n for (const key in this.area) {\n url.searchParams.append(key, this.area[key]);\n }\n return url.toString();\n };\n};\n"],"names":["constructor","editor","Modal","create","type","types","DEFAULT","large","title","body","Templates","render","src","this","getIframeURL","then","modal","getRoot","on","ModalEvents","bodyRendered","selectFirstElement","hidden","destroy","show","document","querySelector","style","cssText","catch","iframe","getElementById","addEventListener","intervalId","setInterval","iDocument","contentWindow","firstFocusableElement","focus","clearInterval","url","URL","Config","wwwroot","searchParams","append","getElement","id","key","area","toString","data","params","itemid","fpoptions","image"],"mappings":"kpDA8B4B,MAKxBA,YAAYC,sCAHH,kCACF,8CASW,KACdC,MAAMC,OAAO,CACTC,KAAMF,MAAMG,MAAMC,QAClBC,OAAO,EACPC,OAAO,mBAAU,yBAA0B,cAC3CC,KAAMC,mBAAUC,OAAO,uBAAwB,CAC3CC,IAAKC,KAAKC,mBAEfC,MAAKC,QACJA,MAAMC,UAAUC,GAAGC,YAAYC,cAAc,UACpCC,wBAETL,MAAMC,UAAUC,GAAGC,YAAYG,QAAQ,KACnCN,MAAMO,aAEVP,MAAMQ,OACNC,SAASC,cAAc,aAAaC,MAAMC,2BACnCZ,SACRa,sDAIc,WACXC,OAASL,SAASM,eAAe,aACvCD,OAAOE,iBAAiB,QAAQ,eACxBC,WAAaC,aAAY,iBACnBC,UAAYL,OAAOM,cAAcX,YACnCU,UAAUT,cAAc,gBAAiB,OACnCW,sBAAwBF,UAAUT,cAAc,gCAClDW,uBACAA,sBAAsBC,QAE1BC,cAAcN,eAEnB,gDAII,WACLO,IAAM,IAAIC,cAAOC,gBAAOC,sDAC9BH,IAAII,aAAaC,OAAO,YAAahC,KAAKZ,OAAO6C,aAAaC,QACzD,MAAMC,OAAOnC,KAAKoC,KACnBT,IAAII,aAAaC,OAAOG,IAAKnC,KAAKoC,KAAKD,aAEpCR,IAAIU,mBAlDNjD,OAASA,aACRkD,MAAO,oBAAQlD,aAChBgD,KAAOE,KAAKC,OAAOH,UACnBA,KAAKI,OAASF,KAAKG,UAAUC,MAAMF"} \ No newline at end of file diff --git a/lib/editor/tiny/plugins/media/amd/src/manager.js b/lib/editor/tiny/plugins/media/amd/src/manager.js index e788b21ba26a9..a1e3abb4796c3 100644 --- a/lib/editor/tiny/plugins/media/amd/src/manager.js +++ b/lib/editor/tiny/plugins/media/amd/src/manager.js @@ -36,7 +36,6 @@ export const MediaManager = class { constructor(editor) { this.editor = editor; const data = getData(editor); - window.console.log(data); this.area = data.params.area; this.area.itemid = data.fpoptions.image.itemid; }