root913 / tinymce-plugin-grid

Grid plugin for tinyMCE WYSIWYG editor.
Other
9 stars 3 forks source link

Is possible add to wordpress tinymce? #15

Open Seelescript opened 1 year ago

Seelescript commented 1 year ago

Hi,

not an issue, just asking is this is possible.

I am using tinymce advance, is a wordpress plugin that extend the editor in wordpress, do you think is possible add this plugin to the wordpress tinymce editor? when I add the plugin.js as tinymce plugin, a error in the console show up about the lang file.

Wordpress tinymce version is '4.9.11'

root913 commented 1 year ago

Hi, i have tested it localy and it works. Here you have sample setup code:

<?php

function my_custom_plugins( $plugins ) {
    $plugins['grid'] = 'http://localhost/wp-content/themes/twentytwentythree/grid/plugin.js';
    return $plugins;
}
add_filter( 'mce_external_plugins', 'my_custom_plugins' );

function my_mce_buttons_2( $buttons ) {
    $buttons[] = 'grid_insert';

    return $buttons;
}
add_filter( 'mce_buttons_2', 'my_mce_buttons_2' );

I have use absolute url to plugin script. It's better to replace it with function that generates it (WP has one). Let me know if it helps.

Seelescript commented 1 year ago

Hi,

Thank you for the answer, but I am getting the error undefined registry, I think this happen because the version of tinymce in wordpress is '4.9.11' and your plugin is for version 5 if I am not wrong.

plugin.js?wp-mce-49110-20201110-tadv-5600:2 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'registry')

https://ibb.co/2P3nXGh