Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1441 ariadna 1
{"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 * Options helper for Tiny AI plugin.\n *\n * @module      tiny_aiplacement/options\n * @copyright   2023 Matt Porritt <matt.porritt@moodle.com>\n * @license     http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport {getPluginOptionName} from 'editor_tiny/options';\nimport {pluginName} from 'tiny_aiplacement/common';\n\nconst contextIdName = getPluginOptionName(pluginName, 'contextid');\nconst userIdName = getPluginOptionName(pluginName, 'userid');\nconst textAllowedName = getPluginOptionName(pluginName, 'generate_text');\nconst imageAllowedName = getPluginOptionName(pluginName, 'generate_image');\nconst policyAgreedName = getPluginOptionName(pluginName, 'policyagreed');\n\n/**\n * Options registration function.\n *\n * @param {tinyMCE} editor\n */\nexport const register = (editor) => {\n    const registerOption = editor.options.register;\n\n    registerOption(contextIdName, {\n        processor: 'number',\n        \"default\": 0,\n    });\n\n    registerOption(userIdName, {\n        processor: 'number',\n        \"default\": 0,\n    });\n\n    registerOption(textAllowedName, {\n        processor: 'boolean',\n        \"default\": false,\n    });\n\n    registerOption(imageAllowedName, {\n        processor: 'boolean',\n        \"default\": false,\n    });\n\n    registerOption(policyAgreedName, {\n        processor: 'boolean',\n        \"default\": false,\n    });\n};\n\n/**\n * Fetch the context ID value for this editor instance.\n *\n * @param {tinyMCE} editor The editor instance to fetch the value for\n * @returns {int} The value of the contextIdName option\n */\nexport const getContextId = (editor) => editor.options.get(contextIdName);\n\n/**\n * Fetch the user ID value for this editor instance.\n *\n * @param {tinyMCE} editor The editor instance to fetch the value for\n * @returns {int} The value of the userIdName option\n */\nexport const getUserId = (editor) => editor.options.get(userIdName);\n\n/**\n * Whether text generation is allowed in this instance.\n *\n * @param {TinyMCE} editor\n * @returns {boolean}\n */\nexport const isTextAllowed = (editor) => editor.options.get(textAllowedName);\n\n/**\n * Whether image generation is allowed in this instance.\n *\n * @param {TinyMCE} editor\n * @returns {boolean}\n */\nexport const isImageAllowed = (editor) => editor.options.get(imageAllowedName);\n\nexport const isPolicyAgreed = (editor) => editor.options.get(policyAgreedName);\n"],"names":["contextIdName","pluginName","userIdName","textAllowedName","imageAllowedName","policyAgreedName","editor","registerOption","options","register","processor","get"],"mappings":";;;;;;;;MA0BMA,eAAgB,gCAAoBC,mBAAY,aAChDC,YAAa,gCAAoBD,mBAAY,UAC7CE,iBAAkB,gCAAoBF,mBAAY,iBAClDG,kBAAmB,gCAAoBH,mBAAY,kBACnDI,kBAAmB,gCAAoBJ,mBAAY,kCAOhCK,eACfC,eAAiBD,OAAOE,QAAQC,SAEtCF,eAAeP,cAAe,CAC1BU,UAAW,iBACA,IAGfH,eAAeL,WAAY,CACvBQ,UAAW,iBACA,IAGfH,eAAeJ,gBAAiB,CAC5BO,UAAW,mBACA,IAGfH,eAAeH,iBAAkB,CAC7BM,UAAW,mBACA,IAGfH,eAAeF,iBAAkB,CAC7BK,UAAW,mBACA,2BAUUJ,QAAWA,OAAOE,QAAQG,IAAIX,kCAQjCM,QAAWA,OAAOE,QAAQG,IAAIT,mCAQ1BI,QAAWA,OAAOE,QAAQG,IAAIR,yCAQ7BG,QAAWA,OAAOE,QAAQG,IAAIP,0CAE9BE,QAAWA,OAAOE,QAAQG,IAAIN"}