%PDF- %PDF-
Direktori : /home/vacivi36/ava/lib/editor/tiny/plugins/media/amd/build/ |
Current File : /home/vacivi36/ava/lib/editor/tiny/plugins/media/amd/build/manager.min.js.map |
{"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 <http://www.gnu.org/licenses/>.\n\n/**\n * Tiny Media Manager plugin class for Moodle.\n *\n * @module tiny_media/manager\n * @copyright 2022, Stevani Andolo <stevani@hotmail.com.au>\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"}