• Hi @azaozz,

    great plugin! I maintain the plugin “TinyMCE Custom Styles”, which I’m currently updating – mainly the description and UI (which were hopelessly inadequate), the code itself continues to work.

    During this phase, I have noticed a bug in AET, see title. It cost me quite some nerves, as the way “TinyMCE Custom Styles” works, I need to describe how it interacts with AET, and which settings to make in AET.

    I have debugged the code of AET far enough to say exactly what is happening, but the fix itself I’ll leave to you – so much to do…

    The problem is, that when the “Create CSS classes menu” option is checked, then when the editor is loaded (to edit a page or post), the ‘importcss’ tinymce plugin is missing in both plugin lists (tiny_mce_plugins + mce_external_plugins).

    When the option is unchecked, then ‘importcss’ is contained in the plugin list mce_external_plugins, and thus loaded (from /wp-content/plugins/tinymce-advanced/mce/table/plugin.min.js).

    Would be most grateful for a quick resolution of this, as I will holf by my own plugin update until the description is correct.

    BTW As a much younger man I once visited Vancouver – loved it and even wanted to relocate (but my wife did not).

    Thanks in advance!

    Tim

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Andrew Ozz

    (@azaozz)

    Hi @tim-reeves,

    Thanks!

    When the option is unchecked, then ‘importcss’ is contained in the plugin list mce_external_plugins, and thus loaded (from /wp-content/plugins/tinymce-advanced/mce/table/plugin.min.js).

    Hmmm, that doesn’t sound right. That TinyMCE plugin is added when the checkbox is checked, here: https://plugins.trac.ww.wp.xz.cn/browser/tinymce-advanced/trunk/tinymce-advanced.php#L657. Then there’s a filter tadv_used_plugins that can be used by other WP plugins: https://plugins.trac.ww.wp.xz.cn/browser/tinymce-advanced/trunk/tinymce-advanced.php#L664.

    Perhaps have a look if another (third-party) plugin is using that filter?

    Thread Starter Tim Reeves

    (@tim-reeves)

    Hi @azaozz ,

    many thanks for your prompt reply!

    I quite agree that it doesn’t sound right, and I had seen and debugged the code around line 657, which seems to work as expected.

    I’ve now checked again, on a dev site with WP 5.7, all plugins except AET deactivated – and still the effect of the checkbox toggles the wrong way round. So for sure no other instance is using the filter tadv_used_plugins.

    The only thing left is the theme – a non-public one I’ve written myself, ultra minimalistic. The only thing it does in the area of TinyMCE is:

    add_action( ‘after_setup_theme’, ‘tris_theme_setup’ ),

    whereby ‘tris_theme_setup’ says:
    add_editor_style([‘tris-root.css’, ‘editor-style.css’]);

    Maybe some mixup in the logic where the theme is already calling add_editor_style?

    As stated, I had debugged the issue up to the point of seeing when the ‘importcss’ plugin is actually being loaded to the frontend, and was myself a bit stumped since the code – as far as I had dug into it – didn’t look like it would do that )-: But I stopped before checking the filters and merges, in the hope that your deeper knowledge might take up the baton more effectively…

    What I would find interesting is if you could do the same test as I have – an effectively naked WP 5.7, with just AET active, and a theme which provides the ‘editor style’ feature. If it works as expected for you, I’ll eat my hat! (Or finally go completely bananas).

    Cheers,

    Tim

    Thread Starter Tim Reeves

    (@tim-reeves)

    Oh and just to add to that: I have also observed that when something gets changed like a plugin being deactivated / activated, or possibly my TCS plugin saving changes (not sure about that one) then things DO work as expected, or rather do not work any more with the “wrong” setting. But then when I toggle the setting twice, I’m back to the situation I know so well – the toggle is wrong way round.

    Thread Starter Tim Reeves

    (@tim-reeves)

    Hi @azaozz ,

    after a nights sleep another look: There’s something really funny going on in this area. I’ve tried different things:

    • On three different WP Installations (one quite recent and it never had many plugins), everywhere problems in this area.
    • On one installation, the theme genuinely does not offer any support for ‘editor styles’; here the “Create CSS…” checkbox is disabled, as should be, and the ‘importcss’ plugin is not loaded, the ‘Formats’ dropdown contains the default entries, as expected.
    • On another (dev) site I tried the themes 2020 and 2021. In each case, the checkbox was again disabled – although these themes surely do support the feature. I remember seeing that they do NOT use the default file ‘editor-style.css’ file, but register other files in some assets areas, as is allowed by add_editor_style, which accepts an array (or string) – it only defaults to ‘editor-style.css’. However, in this case ‘importcss’ is being loaded and the ‘Formats’ dropdown contains the long list of formats from the css files supplied to TinyMCE.
    • On another site, using my own theme which calls “add_editor_style([‘tris-root.css’, ‘editor-style.css’])”, the checkbox is active (presumably because one of my CSS files is ‘editor-style.css’), but the toggle works (mostly?) the wrong way around.

    So I think this identifies the area where the problem is – how AET tests for what is going on outside of itself. Hope this helps!

    Cheers,

    Tim

    Thread Starter Tim Reeves

    (@tim-reeves)

    I’ve noticed and documented this experience:

    o AET is active, “Create CSS classes menu” is checked, but ‘importcss’ is not loaded, the content from my plugin is in the ‘Formats’ dropdown

    o AET deactivated, the content from my plugin is in the ‘Formats’ dropdown

    o AET reactivated, no visit/change to AET settings, the content from my plugin is still in the ‘Formats’ dropdown

    o AET settings saved without change (“Create CSS classes menu” still checked): OOPS ‘importcss’ is loaded, my ‘Formats’ are gone

    o AET setting “Create CSS classes menu” unchecked and saved: OOPS ‘importcss’ is still loaded!

    o AET setting “Create CSS classes menu” checked and saved: Against expectation, ‘importcss’ not loaded, my ‘Formats’ are there

    Since no more replies here, will start a new more specfic request – have done some more debugging.

    Tim

    Thread Starter Tim Reeves

    (@tim-reeves)

    My new thread has also gone unanswered until now.

    After waiting 3 weeks, I am now releasing my new plugin version. I have added a note in the Backend that AET’s options must be saved twice.

    Would still be glad if I can at some time remove that notice…

    Tim

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Create CSS classes menu toggles wrong way round’ is closed to new replies.