Skip to content

fix(pat tinymce): init plugins "help" and "emoticons" #1476

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 23, 2025

Conversation

1letter
Copy link
Contributor

@1letter 1letter commented Jun 22, 2025

  • fix to load the chunk files for init the plugins correctly

  • enable the Plugins "help" and "emoticons" in the Tinymce Controlpanel under "Plugins and Toolbar"

  • in the "menu" config enable emoticons and change the entry to:

    "insert": {
        "title": "Insert",
        "items": "link media | template hr | emoticons"
    },
  • in the "menubar" config enable the help plugin and change the entry to:
edit table format view insert help

Copy link
Member

@petschki petschki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works perfectly, just some code comments.

@@ -264,6 +280,8 @@ export default class TinyMCE {

await self.initLanguage();

await self.initPluginFixes();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of calling a fixing factory I'd prefer to check these plugins in the loop above

let valid_plugins = [];
// tinyMCE Plugins
for (const plugin of this.options.tiny.plugins) {
if (plugin == "plonelink" || plugin == "ploneimage") {
valid_plugins.push(plugin);
continue;
} else if (plugin == "template") {
// load backported template plugin
const TemplatePlugin = (await import("./js/template")).default;
TemplatePlugin();
valid_plugins.push(plugin);
continue;
}
try {
await import("tinymce/plugins/" + plugin);
valid_plugins.push(plugin);
} catch {
log.debug("Could not load TinyMCE plugin: ", plugin);
}
}
this.options.tiny.plugins = valid_plugins;

here are already some "if/else if -> continue" checks for other plugins ... that would be the place for me to search for customizations in plugin loading.

This would also need to put the await self.initLanguage(); before this loop, but that's fine.

What you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For even better readability we could refactor the whole plugin loading loop into a class function ...

@1letter
Copy link
Contributor Author

1letter commented Jun 23, 2025

@petschki Done, I have implemented your suggestion.

@1letter 1letter requested a review from petschki June 23, 2025 08:37
Copy link
Member

@petschki petschki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I've tried this also with pt_BR and de_CH and it works.

@petschki petschki merged commit 5b20d83 into master Jun 23, 2025
3 checks passed
@petschki petschki deleted the fix-tinymce-plugins branch June 23, 2025 09:00
@1letter
Copy link
Contributor Author

1letter commented Jun 23, 2025

can you make a new release of plone.staticresources?

@petschki
Copy link
Member

Preparing it here, but I need to look closer at #1468 because the tab markup has changed and the autotoc id generator seems to be broken ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pat-tinymce plugin 'help' dont work in Plone 6.1 pat-tinymce plugin emoticons dont work in Plone 6.1
2 participants