From b031884e6125e1d5f25538c29d8cb19f3e926bc1 Mon Sep 17 00:00:00 2001 From: "thomas.ludwig" Date: Mon, 17 Jun 2024 11:54:24 +0200 Subject: [PATCH] #14: add quickbar support --- amd/build/configuration.min.js | 2 +- amd/build/configuration.min.js.map | 2 +- amd/src/configuration.js | 9 ++++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/amd/build/configuration.min.js b/amd/build/configuration.min.js index d339e3f..a2bb129 100644 --- a/amd/build/configuration.min.js +++ b/amd/build/configuration.min.js @@ -1,3 +1,3 @@ -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))};var 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;_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}})); //# 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 d87f401..0c1c4eb 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, 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\nexport const configure = (instanceConfig) => {\n return {\n toolbar: configureToolbar(instanceConfig.toolbar),\n menu: configureMenu(instanceConfig.menu),\n };\n};\n"],"names":["instanceConfig","toolbar","forecolor","backcolor","menu"],"mappings":"yNAqC0BA,uBACf,CACHC,SAbkBA,QAaQD,eAAeC,QAZ7CA,SAAU,4BAAkBA,QAAS,aAAc,CAACC,kBAAWC,qBAa3DC,MATeA,KASKJ,eAAeI,KARvCA,MAAO,yBAAeA,KAAM,SAAUF,mBACtCE,MAAO,yBAAeA,KAAM,SAAUD,qBAFnBC,IAAAA,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, 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 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,oBAclCE,6BAV0BC,SAU4BN,eAAeK,4BATzEC,UAAW,kCAAwBA,SAAU,IAAKJ,mBAClDI,UAAW,kCAAwBA,SAAU,IAAKH,qBAFpBG,IAAAA,SANXF,KALGH"} \ No newline at end of file diff --git a/amd/src/configuration.js b/amd/src/configuration.js index 381e114..7420682 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, addToolbarButtons} from 'editor_tiny/utils'; +import {addMenubarItem, addQuickbarsToolbarItem, addToolbarButtons} from 'editor_tiny/utils'; import {forecolor, backcolor} from './common'; const configureToolbar = (toolbar) => { @@ -35,9 +35,16 @@ const configureMenu = (menu) => { return menu; }; +const configureQuickbarToolbar = (quickbar) => { + quickbar = addQuickbarsToolbarItem(quickbar, '|', forecolor); + quickbar = addQuickbarsToolbarItem(quickbar, '|', backcolor); + return quickbar; +}; + export const configure = (instanceConfig) => { return { toolbar: configureToolbar(instanceConfig.toolbar), menu: configureMenu(instanceConfig.menu), + quickbars_selection_toolbar: configureQuickbarToolbar(instanceConfig.quickbars_selection_toolbar), }; };