Feature No Code Attached Yet
avatar nikosdion
nikosdion
24 Apr 2023

Steps to reproduce the issue

Create the file /media/test/plugin.js with the following content:

window.tinymce.create("tinymce.plugins.InlineCodeButtonPlugin", {
    InlineCodeButtonPlugin: function(editor, url) {
        editor.ui.registry.addToggleButton("inlinecode", {
            icon:     "sourcecode",
            title:    "Inline Code",
            tooltip:  "Inline Code",
            onAction: (_) => {
                  editor.execCommand('FormatBlock', false, 'code');
              },
            onSetup: (api) => {
                editor.formatter.formatChanged('code', (state) => {
                    api.setActive(state);
                })
            }
        });
    }
});

window.tinymce.PluginManager.add("inlinecodebutton", tinymce.plugins.InlineCodeButtonPlugin);

Edit the Editor - TinyMCE options (System, Manage, Plugins, search for "Editor - TinyMCE", and click on it).

Towards the bottom of the page find the Custom Plugin setting and set it to inlinecodebutton

In the External Plugin URLs add a new row with the following settings:

  • Plugin Name inlinecodebutton
  • Path /media/test/plugin.js

Expected result

Editing the "Editor - TinyMCE" I can see my custom "Inline Code" button and place it on the toolbar where I want.

Actual result

Editing the "Editor - TinyMCE" plugin settings I cannot see my custom "Inline Code" button.

Instead, I have to set the Custom Button option to inlinecode BUT it does not do what I need! It simply adds my custom button to the end of the toolbar.

Sure, it works, kinda sorta. The thing is, I do not want this button there; it makes no sense. I want it next to my Bold, Italic etc formatting buttons so I can correctly format inline code references in my blog posts without digging through the (very slow to render) drop-down menus.

System information (as much as possible)

Joomla 4.3.0

Everything else is irrelevant.

Additional comments

I think addressing this would require \Joomla\Plugin\Editors\TinyMCE\PluginTraits\KnownButtons::getKnownButtons parsing the "Custom Button" plugin option and append the custom buttons to the returned array (perhaps trying to use a language string such as PLG_EDITORS_TINYMCE_CUSTOM_BUTTON_buttonName for the label, so we can provide something meaningful here?).

Likewise, \Joomla\Plugin\Editors\TinyMCE\PluginTraits\DisplayTrait::onDisplay would need to be modified so that the custom_button option does not append buttons willy-nilly to the toolbar, i.e. it should never set $custom_button.

BTW, allowing custom plugins in the TInyMCE editor plugin is FREAKING AWESOME, but there's scant documentation, y'all. I figured out how to do it by reading the code. I am not sure most users who'd like to use this feature are gluttons for punishment like yours truly ?

avatar nikosdion nikosdion - open - 24 Apr 2023
avatar joomla-cms-bot joomla-cms-bot - change - 24 Apr 2023
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 24 Apr 2023
avatar richard67 richard67 - change - 24 Apr 2023
Labels Added: ?
avatar richard67 richard67 - labeled - 24 Apr 2023
avatar brianteeman
brianteeman - comment - 24 Apr 2023

This is a duplicate report of #39668 but this has more useful information so I will close mine

avatar brianteeman
brianteeman - comment - 24 Apr 2023

Seems that I forgot to actually include the information iin my report and I only documented the minification issue. So leaving my report open - and thanks for adding this @nikosdion

avatar brianteeman
brianteeman - comment - 24 Apr 2023

Found where I made the comment about the icons #36968 (comment)

avatar brianteeman
brianteeman - comment - 24 Apr 2023

AND YES it is awesome to be able to create your own tinymce plugins. I have created several.
As for the slow rendering of the dropdowns that can be resolved if we disable the rendering of the dropdown css

avatar nikosdion
nikosdion - comment - 24 Apr 2023

Yup, I am using custom TinyMCE plugins to simplify my life in my blog and on my site doing support.

avatar nikosdion nikosdion - change - 10 May 2023
Status New Closed
Closed_Date 0000-00-00 00:00:00 2023-05-10 18:32:40
Closed_By nikosdion
Labels Added: Feature
Removed: ?
avatar nikosdion nikosdion - close - 10 May 2023
avatar brianteeman
brianteeman - comment - 10 May 2023

please reopen this

avatar rdeutz
rdeutz - comment - 11 May 2023

Valid issue

avatar rdeutz rdeutz - change - 11 May 2023
Status Closed New
Closed_Date 2023-05-10 18:32:40
Closed_By nikosdion
avatar rdeutz rdeutz - reopen - 11 May 2023
avatar joomleb
joomleb - comment - 24 Nov 2023

Hi guys,
Any idea of progress here?

Add a Comment

Login with GitHub to post a comment