From eb33f57a76a032b6d98ca11949830ee3dda4be3e Mon Sep 17 00:00:00 2001 From: Huong Nguyen Date: Mon, 14 Nov 2022 09:48:15 +0700 Subject: [PATCH] MDL-76261 tiny_equation: Use the correct icon --- .../tiny/plugins/equation/amd/build/commands.min.js | 2 +- .../tiny/plugins/equation/amd/build/commands.min.js.map | 2 +- lib/editor/tiny/plugins/equation/amd/src/commands.js | 2 +- lib/editor/tiny/plugins/equation/pix/icon.svg | 8 ++++++++ 4 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 lib/editor/tiny/plugins/equation/pix/icon.svg diff --git a/lib/editor/tiny/plugins/equation/amd/build/commands.min.js b/lib/editor/tiny/plugins/equation/amd/build/commands.min.js index a9c188298ec..3a214ece4ea 100644 --- a/lib/editor/tiny/plugins/equation/amd/build/commands.min.js +++ b/lib/editor/tiny/plugins/equation/amd/build/commands.min.js @@ -1,3 +1,3 @@ -define("tiny_equation/commands",["exports","editor_tiny/utils","core/str","tiny_equation/common","tiny_equation/ui","tiny_equation/equation","tiny_equation/options"],(function(_exports,_utils,_str,_common,_ui,_equation,_options){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.getSetup=void 0;_exports.getSetup=async()=>{const[buttonText,buttonImage]=await Promise.all([(0,_str.get_string)("buttontitle",_common.component),(0,_utils.getButtonImage)("e/math","core")]);return editor=>{(0,_options.isTexFilterActive)(editor)&&(editor.ui.registry.addIcon(_common.icon,buttonImage.html),editor.ui.registry.addToggleButton(_common.buttonName,{icon:_common.icon,tooltip:buttonText,onAction:()=>{(0,_ui.handleAction)(editor)},onSetup:api=>{editor.on("NodeChange",(()=>{const result=(0,_equation.getSelectedEquation)(editor);api.setActive(result)}))}}),editor.ui.registry.addMenuItem(_common.buttonName,{icon:_common.icon,text:buttonText,onAction:()=>(0,_ui.handleAction)(editor)}))}}})); +define("tiny_equation/commands",["exports","editor_tiny/utils","core/str","tiny_equation/common","tiny_equation/ui","tiny_equation/equation","tiny_equation/options"],(function(_exports,_utils,_str,_common,_ui,_equation,_options){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.getSetup=void 0;_exports.getSetup=async()=>{const[buttonText,buttonImage]=await Promise.all([(0,_str.get_string)("buttontitle",_common.component),(0,_utils.getButtonImage)("icon",_common.component)]);return editor=>{(0,_options.isTexFilterActive)(editor)&&(editor.ui.registry.addIcon(_common.icon,buttonImage.html),editor.ui.registry.addToggleButton(_common.buttonName,{icon:_common.icon,tooltip:buttonText,onAction:()=>{(0,_ui.handleAction)(editor)},onSetup:api=>{editor.on("NodeChange",(()=>{const result=(0,_equation.getSelectedEquation)(editor);api.setActive(result)}))}}),editor.ui.registry.addMenuItem(_common.buttonName,{icon:_common.icon,text:buttonText,onAction:()=>(0,_ui.handleAction)(editor)}))}}})); //# sourceMappingURL=commands.min.js.map \ No newline at end of file diff --git a/lib/editor/tiny/plugins/equation/amd/build/commands.min.js.map b/lib/editor/tiny/plugins/equation/amd/build/commands.min.js.map index edd26f67168..9e5bf80aeb2 100644 --- a/lib/editor/tiny/plugins/equation/amd/build/commands.min.js.map +++ b/lib/editor/tiny/plugins/equation/amd/build/commands.min.js.map @@ -1 +1 @@ -{"version":3,"file":"commands.min.js","sources":["../src/commands.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 .\n\nimport {getButtonImage} from 'editor_tiny/utils';\nimport {get_string as getString} from 'core/str';\nimport {component, buttonName, icon} from 'tiny_equation/common';\nimport {handleAction} from 'tiny_equation/ui';\nimport {getSelectedEquation} from 'tiny_equation/equation';\nimport {isTexFilterActive} from 'tiny_equation/options';\n\n/**\n * Tiny Equation commands.\n *\n * @module tiny_equation/commands\n * @copyright 2022 Huong Nguyen \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nexport const getSetup = async() => {\n const [\n buttonText,\n buttonImage,\n ] = await Promise.all([\n getString('buttontitle', component),\n getButtonImage('e/math', 'core'),\n ]);\n\n return (editor) => {\n if (isTexFilterActive(editor)) {\n // Register the Equation Icon.\n editor.ui.registry.addIcon(icon, buttonImage.html);\n\n // Register the Menu Button as a toggle.\n // This means that when highlighted over an existing Equation element it will show as toggled on.\n editor.ui.registry.addToggleButton(buttonName, {\n icon,\n tooltip: buttonText,\n onAction: () => {\n handleAction(editor);\n },\n onSetup: (api) => {\n editor.on('NodeChange', () => {\n const result = getSelectedEquation(editor);\n api.setActive(result);\n });\n },\n });\n\n // Add the Equation Menu Item.\n // This allows it to be added to a standard menu, or a context menu.\n editor.ui.registry.addMenuItem(buttonName, {\n icon,\n text: buttonText,\n onAction: () => handleAction(editor),\n });\n }\n };\n};\n"],"names":["async","buttonText","buttonImage","Promise","all","component","editor","ui","registry","addIcon","icon","html","addToggleButton","buttonName","tooltip","onAction","onSetup","api","on","result","setActive","addMenuItem","text"],"mappings":"wUA8BwBA,gBAEhBC,WACAC,mBACMC,QAAQC,IAAI,EAClB,mBAAU,cAAeC,oBACzB,yBAAe,SAAU,iBAGrBC,UACA,8BAAkBA,UAElBA,OAAOC,GAAGC,SAASC,QAAQC,aAAMR,YAAYS,MAI7CL,OAAOC,GAAGC,SAASI,gBAAgBC,mBAAY,CAC3CH,KAAAA,aACAI,QAASb,WACTc,SAAU,0BACOT,SAEjBU,QAAUC,MACNX,OAAOY,GAAG,cAAc,WACdC,QAAS,iCAAoBb,QACnCW,IAAIG,UAAUD,cAO1Bb,OAAOC,GAAGC,SAASa,YAAYR,mBAAY,CACvCH,KAAAA,aACAY,KAAMrB,WACNc,SAAU,KAAM,oBAAaT"} \ No newline at end of file +{"version":3,"file":"commands.min.js","sources":["../src/commands.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 .\n\nimport {getButtonImage} from 'editor_tiny/utils';\nimport {get_string as getString} from 'core/str';\nimport {component, buttonName, icon} from 'tiny_equation/common';\nimport {handleAction} from 'tiny_equation/ui';\nimport {getSelectedEquation} from 'tiny_equation/equation';\nimport {isTexFilterActive} from 'tiny_equation/options';\n\n/**\n * Tiny Equation commands.\n *\n * @module tiny_equation/commands\n * @copyright 2022 Huong Nguyen \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nexport const getSetup = async() => {\n const [\n buttonText,\n buttonImage,\n ] = await Promise.all([\n getString('buttontitle', component),\n getButtonImage('icon', component),\n ]);\n\n return (editor) => {\n if (isTexFilterActive(editor)) {\n // Register the Equation Icon.\n editor.ui.registry.addIcon(icon, buttonImage.html);\n\n // Register the Menu Button as a toggle.\n // This means that when highlighted over an existing Equation element it will show as toggled on.\n editor.ui.registry.addToggleButton(buttonName, {\n icon,\n tooltip: buttonText,\n onAction: () => {\n handleAction(editor);\n },\n onSetup: (api) => {\n editor.on('NodeChange', () => {\n const result = getSelectedEquation(editor);\n api.setActive(result);\n });\n },\n });\n\n // Add the Equation Menu Item.\n // This allows it to be added to a standard menu, or a context menu.\n editor.ui.registry.addMenuItem(buttonName, {\n icon,\n text: buttonText,\n onAction: () => handleAction(editor),\n });\n }\n };\n};\n"],"names":["async","buttonText","buttonImage","Promise","all","component","editor","ui","registry","addIcon","icon","html","addToggleButton","buttonName","tooltip","onAction","onSetup","api","on","result","setActive","addMenuItem","text"],"mappings":"wUA8BwBA,gBAEhBC,WACAC,mBACMC,QAAQC,IAAI,EAClB,mBAAU,cAAeC,oBACzB,yBAAe,OAAQA,4BAGnBC,UACA,8BAAkBA,UAElBA,OAAOC,GAAGC,SAASC,QAAQC,aAAMR,YAAYS,MAI7CL,OAAOC,GAAGC,SAASI,gBAAgBC,mBAAY,CAC3CH,KAAAA,aACAI,QAASb,WACTc,SAAU,0BACOT,SAEjBU,QAAUC,MACNX,OAAOY,GAAG,cAAc,WACdC,QAAS,iCAAoBb,QACnCW,IAAIG,UAAUD,cAO1Bb,OAAOC,GAAGC,SAASa,YAAYR,mBAAY,CACvCH,KAAAA,aACAY,KAAMrB,WACNc,SAAU,KAAM,oBAAaT"} \ No newline at end of file diff --git a/lib/editor/tiny/plugins/equation/amd/src/commands.js b/lib/editor/tiny/plugins/equation/amd/src/commands.js index 4e7f317627f..83537d81452 100644 --- a/lib/editor/tiny/plugins/equation/amd/src/commands.js +++ b/lib/editor/tiny/plugins/equation/amd/src/commands.js @@ -34,7 +34,7 @@ export const getSetup = async() => { buttonImage, ] = await Promise.all([ getString('buttontitle', component), - getButtonImage('e/math', 'core'), + getButtonImage('icon', component), ]); return (editor) => { diff --git a/lib/editor/tiny/plugins/equation/pix/icon.svg b/lib/editor/tiny/plugins/equation/pix/icon.svg new file mode 100644 index 00000000000..8f420d0ff84 --- /dev/null +++ b/lib/editor/tiny/plugins/equation/pix/icon.svg @@ -0,0 +1,8 @@ + + + + + + +