AutorÃa | Ultima modificación | Ver Log |
{"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 the Moodle Tiny Autosave plugin.\n *\n * @module tiny_autosave/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\nimport {pluginName} from './common';\nimport {\n getContextId,\n getDraftItemId,\n getPluginOptionName,\n} from 'editor_tiny/options';\nimport {ensureEditorIsValid} from 'editor_tiny/utils';\n\nconst initialisedOptionName = getPluginOptionName(pluginName, 'initialised');\nconst pageHashName = getPluginOptionName(pluginName, 'pagehash');\nconst pageInstanceName = getPluginOptionName(pluginName, 'pageinstance');\nconst backoffTime = getPluginOptionName(pluginName, 'backoffTime');\nconst autosaveHasReset = getPluginOptionName(pluginName, 'autosaveHasReset');\n\nexport const register = (editor) => {\n const registerOption = editor.options.register;\n registerOption(initialisedOptionName, {\n processor: 'boolean',\n \"default\": false,\n });\n\n registerOption(pageHashName, {\n processor: 'string',\n \"default\": '',\n });\n\n registerOption(pageInstanceName, {\n processor: 'string',\n \"default\": '',\n });\n registerOption(pageInst
anceName, {\n processor: 'string',\n \"default\": '',\n });\n registerOption(backoffTime, {\n processor: 'number',\n \"default\": 500,\n });\n registerOption(autosaveHasReset, {\n processor: 'boolean',\n \"default\": false,\n });\n};\n\nexport const isInitialised = (editor) => {\n if (!ensureEditorIsValid(editor)) {\n return false;\n }\n\n return editor.options.get(initialisedOptionName);\n};\nexport const markInitialised = (editor) => editor.options.set(initialisedOptionName, true);\nexport const getPageHash = (editor) => editor.options.get(pageHashName);\nexport const getPageInstance = (editor) => editor.options.get(pageInstanceName);\nexport const getBackoffTime = (editor) => editor.options.get(backoffTime);\nexport const setAutosaveHasReset = (editor) => editor.options.set(autosaveHasReset, true);\nexport const hasAutosaveHasReset = (editor) => editor.options.get(autosaveHasReset);\n\nexport {\n getContextId,\n getDraftItemId,
\n};\n"],"names":["initialisedOptionName","pluginName","pageHashName","pageInstanceName","backoffTime","autosaveHasReset","editor","registerOption","options","register","processor","get","set"],"mappings":";;;;;;;;MA+BMA,uBAAwB,gCAAoBC,mBAAY,eACxDC,cAAe,gCAAoBD,mBAAY,YAC/CE,kBAAmB,gCAAoBF,mBAAY,gBACnDG,aAAc,gCAAoBH,mBAAY,eAC9CI,kBAAmB,gCAAoBJ,mBAAY,sCAEhCK,eACfC,eAAiBD,OAAOE,QAAQC,SACtCF,eAAeP,sBAAuB,CAClCU,UAAW,mBACA,IAGfH,eAAeL,aAAc,CACzBQ,UAAW,iBACA,KAGfH,eAAeJ,iBAAkB,CAC7BO,UAAW,iBACA,KAEfH,eAAeJ,iBAAkB,CAC7BO,UAAW,iBACA,KAEfH,eAAeH,YAAa,CACxBM,UAAW,iBACA,MAEfH,eAAeF,iBAAkB,CAC7BK,UAAW,mBACA,4BAIWJ,WACrB,8BAAoBA,SAIlBA,OAAOE,QAAQG,IAAIX,gDAEEM,QAAWA,OAAOE,QAAQI,IAAIZ,uBAAuB,wBACzDM,QAAWA,OAAOE,QAAQG,IAAIT,uCAC1BI,QAAWA,OAAOE,QAAQG,IAAIR,0CAC/BG,QAAWA,OAAOE,QAAQG,IAAIP,0CACzBE,QAAWA,OAAOE,QAAQI,IAAIP,kBAAkB,gCAChDC,QAAWA,OAAOE,QAAQG,IAAIN"}