dimanche 1 février 2015

tinymce 4 load plugin from external directory


I am testing loading an external plugin in jQuery tinyMCE with wordpress 4.0 thanks to this thread. If I put the plugin in a folder within the tinymce plugins directory it finds it just fine.



$settings = array('tinymce' => array(
'toolbar1' => 'fb_test_button_key, undo, redo',
'plugins' => 'wplink, fb_test',
),
);
wp_editor($id, $name, $settings);


However I want to specify a path outside of this directory. The documentation says to use external_plugin but I cannot get this to work. It always comes up an error in console pointing to the default plugins folder.



$ext1 = get_template_directory_uri() . '/fb_test/plugin.min.js';

$settings = array('tinymce' => array(
'toolbar1' => 'fb_test_button_key, undo, redo',
'plugins' => 'wplink',
'external_plugins' => array(
'fb_test' => $ext1,
),
),
);
wp_editor($id, $name, $settings);


I understand that in earlier versions you have to hook into tinymce and just use plugins with the - char before the plugin



tinymce.PluginManager.load('fb_test', $ext1);

$settings = array('tinymce' => array(
'toolbar1' => 'fb_test_button_key, undo, redo',
'plugins' => 'wplink, -fb_test',
...




Aucun commentaire:

Enregistrer un commentaire