0

I want to use the tinymce fullpage plugin normally included with a standardard tinymce install.

to add the tinymce full page plugin i have tried adding the following:

<?php
    function myformatTinyMCE($in) {
         $in['remove_linebreaks']=false;
         $in['gecko_spellcheck']=false;
         $in['keep_styles']=true;
         $in['accessibility_focus']=true;
         $in['tabfocus_elements']='major-publishing-actions';
         $in['media_strict']=false;
         $in['paste_remove_styles']=false;
         $in['paste_remove_spans']=false;
         $in['paste_strip_class_attributes']='none';
         $in['paste_text_use_dialog']=true;
         $in['wpeditimage_disable_captions']=true;
         $in['plugins']='tabfocus,paste,media,fullscreen,wordpress,wpeditimage,wpgallery,wplink,wpdialogs,wpfullscreen';

         $in['wpautop']=true;
         $in['apply_source_formatting']=false;
         $in['toolbar1']='bold,italic,strikethrough,bullist,numlist,blockquote,hr,alignleft,aligncenter,alignright,link,unlink,wp_more,spellchecker,wp_fullscreen,wp_adv ';
         $in['toolbar2']='formatselect,underline,alignjustify,forecolor,pastetext,removeformat,charmap,outdent,indent,undo,redo,wp_help ';
         $in['toolbar3']='';
         $in['toolbar4']='';
         return $in;
    }
    $settings = array('textarea_name'=>'template');
    wp_editor( get_option('html_template'), 'htmlemaileditor', $settings );
?>

However upon inspection doing that makes it so that tinymce is looking for the tinymce fullpage plugin that does not exist naitive tinymce location it would expect ( /wp-includes/js/tinymce/plugins/fullpage/plugin.min.js ).

I then tried downloading tinymce and extracting just the fullpage plugin directory and placing that plugin in my wordpress plugin i am creating at the path /fullpage_plugin/plugin.min.js. I then tried referencing it doing the following:

<?PHP
add_filter('mce_external_plugins', 'myplugin_register_tinymce_javascript');

function myplugin_register_tinymce_javascript($plugin_array) {
   $plugin_array['myplugin'] = plugins_url('/fullpage_plugin/plugin.min.js',__file__);
   return $plugin_array;
}
?>

It is indeed seeing the file, however for some reason tinymce is still looking for the plugin at ( /wp-includes/js/tinymce/plugins/fullpage/plugin.min.js )

Anybody out there possibly know the right way to enable fullpage support for the standard tinymce wp_editor included with wordpress 3.9.1?

Thanks!

4

1 回答 1

0

按照wordpress codex中的示例,我替换了以下代码:

<?PHP
add_filter('mce_external_plugins', 'myplugin_register_tinymce_javascript');

function myplugin_register_tinymce_javascript($plugin_array) {
   $plugin_array['myplugin'] = plugins_url('/fullpage_plugin/plugin.min.js',__file__);
   return $plugin_array;
}
?>

到以下代码:

<?PHP
add_filter('mce_external_plugins', 'my_custom_plugins');

function my_custom_plugins () {
     $plugins = array('fullpage'); //Add any more plugins you want to load here
     $plugins_array = array();

     //Build the response - the key is the plugin name, value is the URL to the plugin JS
     foreach ($plugins as $plugin ) {
          $plugins_array[ $plugin ] = plugins_url('tinymce/', __FILE__) . $plugin . '/plugin.min.js';
     }
     return $plugins_array;
}
?>

并将 plugin.min.js 更改为相应的路径。

有用!

于 2014-05-28T05:06:38.537 回答