%PDF- %PDF-
Direktori : /home2/vacivi36/ava/lib/editor/tiny/amd/build/ |
Current File : //home2/vacivi36/ava/lib/editor/tiny/amd/build/options.min.js.map |
{"version":3,"file":"options.min.js","sources":["../src/options.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 * Option helper for TinyMCE Editor Manager.\n *\n * @module editor_tiny/options\n * @copyright 2022 Andrew Lyons <andrew@nicols.co.uk>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nconst optionContextId = 'moodle:contextid';\nconst optionDraftItemId = 'moodle:draftitemid';\nconst filePickers = 'moodle:filepickers';\nconst optionsMoodleLang = 'moodle:language';\nconst currentLanguage = 'moodle:currentLanguage';\nconst optionPlaceholderSelectors = 'moodle:placeholderSelectors';\nconst nestedMenu = 'moodle:nestedmenu';\n\nexport const register = (editor, options) => {\n const registerOption = editor.options.register;\n const setOption = editor.options.set;\n\n registerOption(optionContextId, {\n processor: 'number',\n \"default\": 0,\n });\n setOption(optionContextId, options.context);\n\n registerOption(filePickers, {\n processor: 'object',\n \"default\": {},\n });\n setOption(filePickers, options.filepicker);\n\n registerOption(optionDraftItemId, {\n processor: 'number',\n \"default\": 0,\n });\n setOption(optionDraftItemId, options.draftitemid);\n\n registerOption(currentLanguage, {\n processor: 'string',\n \"default\": 'en',\n });\n setOption(currentLanguage, options.currentLanguage);\n\n // This is primarily used by the media plugin, but it may be re-used elsewhere so is included here as it is large.\n registerOption(optionsMoodleLang, {\n processor: 'object',\n \"default\": {},\n });\n setOption(optionsMoodleLang, options.language);\n\n registerOption(optionPlaceholderSelectors, {\n processor: 'array',\n \"default\": [],\n });\n setOption(optionPlaceholderSelectors, options.placeholderSelectors);\n\n registerOption(nestedMenu, {\n processor: 'boolean',\n \"default\": false,\n });\n setOption(nestedMenu, options.nestedmenu);\n};\n\nexport const getContextId = (editor) => editor.options.get(optionContextId);\nexport const getDraftItemId = (editor) => editor.options.get(optionDraftItemId);\nexport const getFilepickers = (editor) => editor.options.get(filePickers);\nexport const getFilePicker = (editor, type) => getFilepickers(editor)[type];\nexport const getMoodleLang = (editor) => editor.options.get(optionsMoodleLang);\nexport const getCurrentLanguage = (editor) => editor.options.get(currentLanguage);\nexport const getNestedMenu = (editor) => editor.options.get(nestedMenu);\n\n/**\n * Get a set of namespaced options for all defined plugins.\n *\n * @param {object} options\n * @returns {object}\n */\nexport const getInitialPluginConfiguration = (options) => {\n const config = {};\n\n Object.entries(options.plugins).forEach(([pluginName, pluginConfig]) => {\n const values = Object.entries(pluginConfig.config ?? {});\n values.forEach(([optionName, value]) => {\n config[getPluginOptionName(pluginName, optionName)] = value;\n });\n });\n\n return config;\n};\n\n/**\n * Get the namespaced option name for a plugin.\n *\n * @param {string} pluginName\n * @param {string} optionName\n * @returns {string}\n */\nexport const getPluginOptionName = (pluginName, optionName) => `${pluginName}:${optionName}`;\n\n/**\n * Get the placeholder selectors.\n *\n * @param {TinyMCE} editor\n * @returns {array}\n */\nexport const getPlaceholderSelectors = (editor) => editor.options.get(optionPlaceholderSelectors);\n\n/**\n * Register placeholder selectos.\n *\n * @param {TinyMCE} editor\n * @param {array} selectors\n */\nexport const registerPlaceholderSelectors = (editor, selectors) => {\n if (selectors.length) {\n let existingData = getPlaceholderSelectors(editor);\n existingData = existingData.concat(selectors);\n editor.options.set(optionPlaceholderSelectors, existingData);\n }\n};\n"],"names":["editor","options","registerOption","register","setOption","set","processor","context","filepicker","draftitemid","currentLanguage","language","placeholderSelectors","nestedmenu","get","getFilepickers","type","config","Object","entries","plugins","forEach","_ref","pluginName","pluginConfig","_ref2","optionName","value","getPluginOptionName","getPlaceholderSelectors","selectors","length","existingData","concat"],"mappings":"kdA+BwB,CAACA,OAAQC,iBACvBC,eAAiBF,OAAOC,QAAQE,SAChCC,UAAYJ,OAAOC,QAAQI,IAEjCH,eAZoB,mBAYY,CAC5BI,UAAW,iBACA,IAEfF,UAhBoB,mBAgBOH,QAAQM,SAEnCL,eAhBgB,qBAgBY,CACxBI,UAAW,iBACA,KAEfF,UApBgB,qBAoBOH,QAAQO,YAE/BN,eAvBsB,qBAuBY,CAC9BI,UAAW,iBACA,IAEfF,UA3BsB,qBA2BOH,QAAQQ,aAErCP,eA1BoB,yBA0BY,CAC5BI,UAAW,iBACA,OAEfF,UA9BoB,yBA8BOH,QAAQS,iBAGnCR,eAlCsB,kBAkCY,CAC9BI,UAAW,iBACA,KAEfF,UAtCsB,kBAsCOH,QAAQU,UAErCT,eAtC+B,8BAsCY,CACvCI,UAAW,gBACA,KAEfF,UA1C+B,8BA0COH,QAAQW,sBAE9CV,eA3Ce,oBA2CY,CACvBI,UAAW,mBACA,IAEfF,UA/Ce,oBA+COH,QAAQY,mCAGLb,QAAWA,OAAOC,QAAQa,IAxD/B,4CAyDOd,QAAWA,OAAOC,QAAQa,IAxD/B,4BAyDbC,eAAkBf,QAAWA,OAAOC,QAAQa,IAxDrC,oFAyDS,CAACd,OAAQgB,OAASD,eAAef,QAAQgB,6BACxChB,QAAWA,OAAOC,QAAQa,IAzD9B,+CA0DSd,QAAWA,OAAOC,QAAQa,IAzDrC,iDA0DMd,QAAWA,OAAOC,QAAQa,IAxDrC,4DAgE2Bb,gBACpCgB,OAAS,UAEfC,OAAOC,QAAQlB,QAAQmB,SAASC,SAAQC,oCAAEC,WAAYC,mBACnCN,OAAOC,qCAAQK,aAAaP,4DAAU,IAC9CI,SAAQI,YAAEC,WAAYC,aACzBV,OAAOW,oBAAoBL,WAAYG,aAAeC,YAIvDV,cAUEW,oBAAsB,CAACL,WAAYG,uBAAkBH,uBAAcG,mEAQnEG,wBAA2B7B,QAAWA,OAAOC,QAAQa,IA7F/B,8HAqGS,CAACd,OAAQ8B,gBAC7CA,UAAUC,OAAQ,KACdC,aAAeH,wBAAwB7B,QAC3CgC,aAAeA,aAAaC,OAAOH,WACnC9B,OAAOC,QAAQI,IAzGY,8BAyGoB2B"}