简体   繁体   中英

TinyMCE some buttons are not showing up

I am trying to add a link/unlink and image button to my TinyMCE editor. Now I have the following code:

tinymce.init({
  selector: 'textarea',  // change this value according to your HTML
  toolbar1: 'link unlink image',
  toolbar2: 'undo redo | styleselect | bold italic | link | alignleft aligncenter alignright'
});

However its showing an empty first toolbar. Please see my fiddle: JSFiddle

You have used two toolbars though the issue seems to be with plugins, try instead using below:

tinymce.init({
  selector: 'textarea',  // change this value according to your HTML
  plugins: [
        "advlist autolink lists link image charmap print preview anchor",
        "searchreplace visualblocks code fullscreen",
        "insertdatetime media table contextmenu paste"
  ],
  toolbar: 'undo redo | styleselect | bold italic | link | alignleft aligncenter alignright | link image',

});

DEMO

You just need to add needed plugins:

tinymce.init({
      selector: 'textarea',  // change this value according to your HTML
      toolbar1: 'link unlink image',
      toolbar2: 'undo redo | styleselect | bold italic | link | alignleft aligncenter alignright',
      plugins: ["link image"],
    });

Default icons are required to be imported in TinyMCE 5.3 or above.

import 'tinymce/icons/default';

Here are the references:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM