From 02be872b907efc0a1d432e444b283780d55aba90 Mon Sep 17 00:00:00 2001 From: Stephan Robotta Date: Fri, 16 Aug 2024 17:10:54 +0200 Subject: [PATCH] Use a different way to add icons to context menu --- amd/build/configuration.min.js | 10 +++++++++- amd/build/configuration.min.js.map | 2 +- amd/src/configuration.js | 10 ++++------ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/amd/build/configuration.min.js b/amd/build/configuration.min.js index a2bb129..25dd2a7 100644 --- a/amd/build/configuration.min.js +++ b/amd/build/configuration.min.js @@ -1,3 +1,11 @@ -define("tiny_fontcolor/configuration",["exports","editor_tiny/utils","./common"],(function(_exports,_utils,_common){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.configure=void 0;_exports.configure=instanceConfig=>{return{toolbar:(toolbar=instanceConfig.toolbar,toolbar=(0,_utils.addToolbarButtons)(toolbar,"formatting",[_common.forecolor,_common.backcolor])),menu:(menu=instanceConfig.menu,menu=(0,_utils.addMenubarItem)(menu,"format",_common.forecolor),menu=(0,_utils.addMenubarItem)(menu,"format",_common.backcolor)),quickbars_selection_toolbar:(quickbar=instanceConfig.quickbars_selection_toolbar,quickbar=(0,_utils.addQuickbarsToolbarItem)(quickbar,"|",_common.forecolor),quickbar=(0,_utils.addQuickbarsToolbarItem)(quickbar,"|",_common.backcolor))};var quickbar,menu,toolbar}})); +define("tiny_fontcolor/configuration",["exports","editor_tiny/utils","./common"],(function(_exports,_utils,_common){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.configure=void 0; +/** + * Tiny tiny_fontcolor for Moodle. + * + * @module tiny_fontcolor + * @copyright 2023 Luca Bösch + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +const configureContextMenu=menu=>(0,_utils.addContextmenuItem)(menu,"|",_common.forecolor,_common.backcolor);_exports.configure=instanceConfig=>{return{toolbar:(toolbar=instanceConfig.toolbar,toolbar=(0,_utils.addToolbarButtons)(toolbar,"formatting",[_common.forecolor,_common.backcolor])),menu:(menu=instanceConfig.menu,menu=(0,_utils.addMenubarItem)(menu,"format",_common.forecolor),menu=(0,_utils.addMenubarItem)(menu,"format",_common.backcolor)),quickbars_selection_toolbar:configureContextMenu(instanceConfig.quickbars_selection_toolbar)};var menu,toolbar}})); //# sourceMappingURL=configuration.min.js.map \ No newline at end of file diff --git a/amd/build/configuration.min.js.map b/amd/build/configuration.min.js.map index 62342e8..0f1d875 100644 --- a/amd/build/configuration.min.js.map +++ b/amd/build/configuration.min.js.map @@ -1 +1 @@ -{"version":3,"file":"configuration.min.js","sources":["../src/configuration.js"],"sourcesContent":["// This file is part of Moodle - https://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 tiny_fontcolor for Moodle.\n *\n * @module tiny_fontcolor\n * @copyright 2023 Luca Bösch \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport {addMenubarItem, addQuickbarsToolbarItem, addToolbarButtons} from 'editor_tiny/utils';\nimport {forecolor, backcolor} from './common';\n\nconst configureToolbar = (toolbar) => {\n toolbar = addToolbarButtons(toolbar, 'formatting', [forecolor, backcolor]);\n return toolbar;\n};\n\nconst configureMenu = (menu) => {\n menu = addMenubarItem(menu, 'format', forecolor);\n menu = addMenubarItem(menu, 'format', backcolor);\n return menu;\n};\n\nconst configureQuickbarToolbar = (quickbar) => {\n quickbar = addQuickbarsToolbarItem(quickbar, '|', forecolor);\n quickbar = addQuickbarsToolbarItem(quickbar, '|', backcolor);\n return quickbar;\n};\n\nexport const configure = (instanceConfig) => {\n return {\n toolbar: configureToolbar(instanceConfig.toolbar),\n menu: configureMenu(instanceConfig.menu),\n // eslint-disable-next-line camelcase\n quickbars_selection_toolbar: configureQuickbarToolbar(instanceConfig.quickbars_selection_toolbar),\n };\n};\n"],"names":["instanceConfig","toolbar","forecolor","backcolor","menu","quickbars_selection_toolbar","quickbar"],"mappings":"yNA2C0BA,uBACf,CACHC,SAnBkBA,QAmBQD,eAAeC,QAlB7CA,SAAU,4BAAkBA,QAAS,aAAc,CAACC,kBAAWC,qBAmB3DC,MAfeA,KAeKJ,eAAeI,KAdvCA,MAAO,yBAAeA,KAAM,SAAUF,mBACtCE,MAAO,yBAAeA,KAAM,SAAUD,oBAelCE,6BAX0BC,SAW4BN,eAAeK,4BAVzEC,UAAW,kCAAwBA,SAAU,IAAKJ,mBAClDI,UAAW,kCAAwBA,SAAU,IAAKH,qBAFpBG,IAAAA,SANXF,KALGH"} \ No newline at end of file +{"version":3,"file":"configuration.min.js","sources":["../src/configuration.js"],"sourcesContent":["// This file is part of Moodle - https://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 tiny_fontcolor for Moodle.\n *\n * @module tiny_fontcolor\n * @copyright 2023 Luca Bösch \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport {addMenubarItem, addContextmenuItem, addToolbarButtons} from 'editor_tiny/utils';\nimport {forecolor, backcolor} from './common';\n\nconst configureToolbar = (toolbar) => {\n toolbar = addToolbarButtons(toolbar, 'formatting', [forecolor, backcolor]);\n return toolbar;\n};\n\nconst configureMenu = (menu) => {\n menu = addMenubarItem(menu, 'format', forecolor);\n menu = addMenubarItem(menu, 'format', backcolor);\n return menu;\n};\n\nconst configureContextMenu = (menu) => {\n return addContextmenuItem(menu, '|', forecolor, backcolor);\n};\n\nexport const configure = (instanceConfig) => {\n return {\n toolbar: configureToolbar(instanceConfig.toolbar),\n menu: configureMenu(instanceConfig.menu),\n // eslint-disable-next-line camelcase\n quickbars_selection_toolbar: configureContextMenu(instanceConfig.quickbars_selection_toolbar),\n };\n};\n"],"names":["configureContextMenu","menu","forecolor","backcolor","instanceConfig","toolbar","quickbars_selection_toolbar"],"mappings":";;;;;;;;MAqCMA,qBAAwBC,OACnB,6BAAmBA,KAAM,IAAKC,kBAAWC,sCAG1BC,uBACf,CACHC,SAjBkBA,QAiBQD,eAAeC,QAhB7CA,SAAU,4BAAkBA,QAAS,aAAc,CAACH,kBAAWC,qBAiB3DF,MAbeA,KAaKG,eAAeH,KAZvCA,MAAO,yBAAeA,KAAM,SAAUC,mBACtCD,MAAO,yBAAeA,KAAM,SAAUE,oBAalCG,4BAA6BN,qBAAqBI,eAAeE,8BAflDL,IAAAA,KALGI"} \ No newline at end of file diff --git a/amd/src/configuration.js b/amd/src/configuration.js index 769f495..43ac5ff 100644 --- a/amd/src/configuration.js +++ b/amd/src/configuration.js @@ -21,7 +21,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -import {addMenubarItem, addQuickbarsToolbarItem, addToolbarButtons} from 'editor_tiny/utils'; +import {addMenubarItem, addContextmenuItem, addToolbarButtons} from 'editor_tiny/utils'; import {forecolor, backcolor} from './common'; const configureToolbar = (toolbar) => { @@ -35,10 +35,8 @@ const configureMenu = (menu) => { return menu; }; -const configureQuickbarToolbar = (quickbar) => { - quickbar = addQuickbarsToolbarItem(quickbar, '|', forecolor); - quickbar = addQuickbarsToolbarItem(quickbar, '|', backcolor); - return quickbar; +const configureContextMenu = (menu) => { + return addContextmenuItem(menu, '|', forecolor, backcolor); }; export const configure = (instanceConfig) => { @@ -46,6 +44,6 @@ export const configure = (instanceConfig) => { toolbar: configureToolbar(instanceConfig.toolbar), menu: configureMenu(instanceConfig.menu), // eslint-disable-next-line camelcase - quickbars_selection_toolbar: configureQuickbarToolbar(instanceConfig.quickbars_selection_toolbar), + quickbars_selection_toolbar: configureContextMenu(instanceConfig.quickbars_selection_toolbar), }; };